Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
chitts
Starting Member
7 Posts |
Posted - 2001-02-19 : 10:14:18
|
| Hi friends! I wanted to if i could write a dynamic query in a stored procedure??? I have a table name table1. The field name is like this FieldName1,FieldName2,FieldName3. I wanna to write a sp like this Create proc spProc1( @fld1 varchar(20), @fld2 varchar(20), @fld3 intif (@fld1 <> '' and (@fld2 <> '' or @fld2 <> 'ALL') and @fld3 <> '' ) Begin Select table1.FieldName1,table1.FieldName2,table1.FieldName3 from table1 where if(@fld3 =1) begin some condition end else begin some condition end End Your timely help is highly appreciated.Thankyou in advanceChitts |
|
|
|
|
|