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 |
pespes
Starting Member
6 Posts |
Posted - 2008-07-30 : 05:19:49
|
hello alli am new to writing stored procedures ...i have read a couple of books to that effect i have a challenge with writing this "insert prcoedure" CREATE PROCEDURE db.appuserid @username varchar(30)@pwd varchar (20)AS--insert into login table insert into login (username, pwd) values (@username@pwd)The error given is declare variable @usernameand syntax error near pwd..pls help me outthanks in advance |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-30 : 05:29:19
|
Where is the comma? E 12°55'05.25"N 56°04'39.16" |
 |
|
pespes
Starting Member
6 Posts |
Posted - 2008-07-30 : 05:44:55
|
thanks,placed the comma there and it worksbut i believe i can insert a lot of values on that same manner and it'll work can u explain why declare is always therewhat it is used for? |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-30 : 07:30:34
|
quote: Originally posted by pespes thanks,placed the comma there and it worksbut i believe i can insert a lot of values on that same manner and it'll work can u explain why declare is always therewhat it is used for?
Where did you use declare in the procedure?MadhivananFailing to plan is Planning to fail |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-30 : 08:05:22
|
He probably means the parameters in the procedure header. E 12°55'05.25"N 56°04'39.16" |
 |
|
pespes
Starting Member
6 Posts |
Posted - 2008-07-30 : 11:22:17
|
there is a declare keyword ...that is usually used in sql and that was what i was talking about ...how do i use the @@ error keyword i need examples...thanks i advance |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-30 : 11:27:39
|
quote: Originally posted by pespes there is a declare keyword ...that is usually used in sql and that was what i was talking about ...how do i use the @@ error keyword i need examples...thanks i advance
Read it in SQL Server help fileMadhivananFailing to plan is Planning to fail |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-30 : 13:43:53
|
quote: Originally posted by pespes there is a declare keyword ...that is usually used in sql and that was what i was talking about ...how do i use the @@ error keyword i need examples...thanks i advance
1.declare is used for declaration of variables in sql http://doc.ddart.net/mssql/sql70/de-dz_2.htm2. @@error returns the error number whenever error occurs. for syntax and usage example refer books online orhttp://doc.ddart.net/mssql/sql70/globals_5.htm |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-30 : 13:45:09
|
Also make sure you search in books online before posting these type of questions in future. |
 |
|
|
|
|