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 |
|
kirannatt
Yak Posting Veteran
66 Posts |
Posted - 2006-09-08 : 14:39:48
|
| HI All,I need to insert multiple recs into table. Table has three columns. One of column value is static and second value is identity but third values is based on complex select statement like thisColvalue3=SELECT * FROM user WHERE UserID IN ( SELECT UserID FROM UserRoles WHERE UserRe = 2)it gived me multiple values.I don't know to insert this big select statement into my insert statement. I am trying to do something like thisinsert into Form(Col2,Col3)values(1001,ColValue3)Plz Help me out! |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-09-08 : 14:44:45
|
| is this what you're looking for?insert Form (col2, col3)select 1001, <single columnName from user table>from user where userid in (select userid from userRoles where UserRe = 2)Be One with the OptimizerTG |
 |
|
|
kirannatt
Yak Posting Veteran
66 Posts |
Posted - 2006-09-08 : 16:29:53
|
| Thanks! Seems like there is for me to learn in SQL. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-09-08 : 16:33:22
|
| All of us still have things to learn about T-SQL and SQL Server.Tara Kizer |
 |
|
|
kirannatt
Yak Posting Veteran
66 Posts |
Posted - 2006-09-08 : 17:09:53
|
| Actually, I wanted to say lot more to learn :-)Another question: I Don't understad meaning of COLLATE SQL_Latin1_General_CP1_CI. I have alter table statement below but I don't not what does COLLATE SQL_Latin1_General_CP1_CI do at the end. Can you explain plz?ALTER TABLE user ADD[UserName] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULLGO |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-09-08 : 17:11:55
|
| It just specifies which collation to use for the column. If you just want the default to be used, then you can omit that part. See Collations in BOL for more details.Tara Kizer |
 |
|
|
|
|
|