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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 insert select with default values?

Author  Topic 

Zim327
Yak Posting Veteran

62 Posts

Posted - 2005-01-11 : 17:09:48
Hi,
I'm trying to insert 300 usernames into a database. I have the usernames in a table called StakeNames. I need to insert these names into a User table with some additional data.
I'm trying to do something like this
insert into T_Users(sUserName, nOrg_ID = 212, bAdmin = 0, bSuperUser = 0, nS_ID = 10, sUpdateBy = 'Me')
select * from StakeNames

How can I do this??

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-01-11 : 17:24:33
insert into T_Users(sUserName, nOrg_ID, bAdmin, bSuperUser, nS_ID, sUpdateBy)
select sUserName, 212, 0, 0, 10, 'Me'
from stakenames

You won't be able to use select *. You will need to use an explicit column list.

Tara
Go to Top of Page

Zim327
Yak Posting Veteran

62 Posts

Posted - 2005-01-11 : 17:31:25
Hey thanks! You have my vote for SQL Empress!
Thanks again,
Zim
Go to Top of Page
   

- Advertisement -