[SQL Server] Search Using Stored Procedure |
Posted: 22 Sep 2013 12:51 PM PDT Hi to all :-)I want to have a result like this ---- SELECT * FROM TestMyView WHERE firstname = 'test5'but my code will produce like this ---- @SqlQuery firstname = @firstnamewhat is wrong with this??...use BiographyDeclare @firstname varchar(50),@middlename varchar(50),@lastname varchar(50), @sex varchar(50),@status varchar(50),@SqlQuery varchar(max),@bioID int, @SqlQueryFirstName varchar(max) SET @bioID = 13 SET @firstname = 'test5' SET @middlename = 'test' SET @lastname = 'tes' SET @sex = 'Female' SET @status = 'single' SET @SqlQuery = '' SET @SqlQueryFirstName = '' -- SELECT * FROM TestMyView-- WHERE firstname = @firstname AND middlename = @middlename AND lastname = @lastname AND sex = @sex AND status = @status AND bioID = @bioID SET @SqlQuery = 'SELECT * FROM TestMyView WHERE ' SET @SqlQueryFirstName = '@SqlQuery ' + 'firstname = @firstname' print(@SqlQueryFirstName) thanks :-) |
Posted: 22 Sep 2013 07:57 AM PDT Hi,I'm trying to insert random date in yyyy-mm format to have expiry Credit card date column.Haw can I do it? is it possible at all? I know that I can sore the full (yyyy-mm-dd) and then to select with: convert(char(7),column_a,121) but this is not the way I'm looking for .Thanks |
You are subscribed to email updates from SQLServerCentral / SQL Server 2008 / SQL Server Newbies To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment