shyam Posted July 13, 2009 Share Posted July 13, 2009 HELLO ALL, i have a problem with below querycreate procedure selectallreg@name varchar(50)asselect * from generalreg where name like @name'%'I WANT TO CREATE A QUERY WHICH RETURN THE NAME START WITH GIVEN DATA;EXAMPLEIF "SA" IS GIVEN AS A VALUE TO @NAMETHEN IT WILL RETURN DATA START NAME WITH "SA"HELP PLS.... Link to comment Share on other sites More sharing options...
justsomeguy Posted July 13, 2009 Share Posted July 13, 2009 What database is this for? Link to comment Share on other sites More sharing options...
shyam Posted July 13, 2009 Author Share Posted July 13, 2009 table name is "generalreg"database name is not need in stored procedure because procedure it self lies in database Link to comment Share on other sites More sharing options...
justsomeguy Posted July 13, 2009 Share Posted July 13, 2009 I mean which DBMS are you using? MySQL? SQL Server? Oracle? Link to comment Share on other sites More sharing options...
shyam Posted July 13, 2009 Author Share Posted July 13, 2009 SORRY SIR i am using sql server 2005 Link to comment Share on other sites More sharing options...
justsomeguy Posted July 13, 2009 Share Posted July 13, 2009 Check examples C and D on this page:http://msdn.microsoft.com/en-us/library/aa...59(SQL.80).aspxIt looks like the way to do it is to send the percent wildcard sign with the data. So instead of sending the SP "SA" as the name, you would send "SA%". If you want to automatically add the wildcard in the SP, there is probably a string concatenation function you can use for that. Link to comment Share on other sites More sharing options...
shyam Posted July 14, 2009 Author Share Posted July 14, 2009 thank you sir (once again)Igot the answeri have to pass the value which already contain '%' Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.