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 |
|
kasaya
Starting Member
10 Posts |
Posted - 2009-01-07 : 22:04:04
|
| Hi...this is my first post ^_^INSERT INTO tbl (Name,Parameter, DataType,UserName,DataType) VALUES ('name1.child',(SELECT Parameter,DataType FROM tbl2 WHERE Name = 'Chart1'),'admin','string') can u help me fix this query ^_^this query generatesSubqueries are not allowed in this context. Only scalar expressions are allowed.this query will save hardcoded data and data result from the querythanks,KaSaYa |
|
|
chrianth
Yak Posting Veteran
50 Posts |
Posted - 2009-01-07 : 22:24:58
|
quote: Originally posted by kasaya Hi...this is my first post ^_^INSERT INTO tbl (Name,Parameter, DataType,UserName,DataType) VALUES ('name1.child',(SELECT Parameter,DataType FROM tbl2 WHERE Name = 'Chart1'),'admin','string') can u help me fix this query ^_^this query generatesSubqueries are not allowed in this context. Only scalar expressions are allowed.this query will save hardcoded data and data result from the querythanks,KaSaYa
is this what you're trying to have?INSERT INTO tbl(Name,Parameter, DataType,UserName,DataType)SELECT 'name1.child', Parameter, UserName, DataTypeFROM tbl2WHERE Name = 'Chart1'Also I added the Username column on your selection because you might have been missed it, but if you want it not to be included on your insert then replace it with ''Hope this helps. |
 |
|
|
kasaya
Starting Member
10 Posts |
Posted - 2009-01-07 : 22:44:53
|
quote: is this what you're trying to have?INSERT INTO tbl(Name,Parameter, DataType,UserName,DataType)SELECT 'name1.child', Parameter, UserName, DataTypeFROM tbl2WHERE Name = 'Chart1'Also I added the Username column on your selection because you might have been missed it, but if you want it not to be included on your insert then replace it with ''Hope this helps.
Hi,thanks for the reply..it did work....thanks a lot sir KaSaYa |
 |
|
|
|
|
|
|
|