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 |
|
kamal.A
Yak Posting Veteran
70 Posts |
Posted - 2008-09-01 : 13:59:05
|
| Hi All,I write a stored procedure below is it correct?CREATE PROCEDURE tempAsDECLARE @CompanyId AS BigInt@CompanyId = SELECT LNCN_ParentId FROM Contact WHERE ContactId = 12INSERT INTO tempTbl(CompanyId) VALUES(@CompanyId) ENDI got the below error,.correct syntax near '@CompanyId'.Must declare the variable '@CompanyId'.Kindly help me...Kamal... |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-09-01 : 15:42:10
|
change this:@CompanyId = SELECT LNCN_ParentId FROM Contact WHERE ContactId = 12to this: SELECT @CompanyId=LNCN_ParentId FROM Contact WHERE ContactId = 12 elsasoft.org |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-02 : 02:50:03
|
| orCREATE PROCEDURE tempAsINSERT INTO tempTbl(CompanyId) SELECT LNCN_ParentId FROM Contact WHERE ContactId = 12MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|