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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 error in stored procedure

Author  Topic 

new_developer
Starting Member

18 Posts

Posted - 2010-11-09 : 08:28:48
hi for all
i try to write stored procedue
to retrive data from table
CREATE PROCEDURE viewdocument
{
@name nvarchar(50)
}

select * from document where title like '@name'

but it give me message error
incorrect Syntax near '{'.
any one can tell me what is the error here
and thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-09 : 08:30:15
replace { and } by ( and )


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-11-09 : 08:51:23
Also replace

select * from document where title like '@name'

by

select * from document where title like @name+'%'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

new_developer
Starting Member

18 Posts

Posted - 2010-11-09 : 08:58:34
My friend who I have worked I have said to me, but
i get another error
error message i get
incorrect syntax near the keyword 'select'
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-09 : 09:00:56
create proc ...
(
var
)
AS
select ...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

new_developer
Starting Member

18 Posts

Posted - 2010-11-09 : 14:51:22
friends thank you it workes
Go to Top of Page
   

- Advertisement -