Jump to content
Sign in to follow this  
shyam

Stored Procedure Prob

Recommended Posts

HELLO ALL,

i have a problem with below query
create 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....

Share this post


Link to post
Share on other sites

table name is "generalreg"database name is not need in stored procedure because procedure it self lies in database

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

thank you sir (once again)Igot the answeri have to pass the value which already contain '%'

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...