June 22, 2006 at 12:13 pm
the sp below works fine, the thing is I need a little help to add one more piece, I'd like to add something at the end which is
and [Platform] = 'PDA'
I've tried all sorts of combinations but still can't get it to work, in deperation I'm turning to you guys for help
CREATE PROCEDURE spSearch_For_Software @sTitle as VarChar(200),@sField as varchar(200)
AS
set nocount on
declare @sSQL as varchar(200)
set @sSQL = 'select * from [Club CDs] where [' + '' + @sfield + '' + '] like ' + '''' + @sTitle + ''''
exec (@sSQL)
GO
June 22, 2006 at 12:21 pm
CREATE PROCEDURE spSearch_For_Software @sTitle as VarChar(200),@sField as varchar(200)
AS
set nocount on
declare @sSQL as varchar(200)
set @sSQL = 'select * from [Club CDs] where [' + '' + @sfield + '' + '] like ' + '''' + @sTitle + ''' AND and [Platform] = ''PDA'''
exec (@sSQL)
GO
N 56°04'39.16"
E 12°55'05.25"
June 22, 2006 at 1:04 pm
thanks for the quick reply Peter, unfortunatly it didn't work
June 22, 2006 at 8:04 pm
it's the extra And "+ ''' AND and [Platform] = ''PDA''' "
change it to + ''' and [Platform] = ''PDA'''
also is PDA always the filter if not do this:
CREATE PROCEDURE spSearch_For_Software @sTitle as VarChar(200),@sField as varchar(200),@sPlatform Varchar(200)
AS
set nocount on
declare @sSQL as varchar(200)
set @sSQL = 'select * from [Club CDs] where [' + '' + @sfield + '' + '] like ' + '''' + @sTitle + ''' and [Platform] = '''+@sPlatform+''''
exec (@sSQL)
-
June 22, 2006 at 8:25 pm
Peter used two "AND"s just due to a cut'n'paste error... remove one of the "AND"s and it'll probably work just fine.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2006 at 6:34 am
thanks people, the sp that Jason posted was exactly what I needed. What would people like me do without people like you. Thanks again
June 23, 2006 at 7:02 am
Sorry for my obvious post, Jason... I pulled to reply to Mick's post and got distracted... in that time, you answered and I didn't see it.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply