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 2005 Forums
 Transact-SQL (2005)
 insert statement for a bunch of columns

Author  Topic 

BitShift
Yak Posting Veteran

98 Posts

Posted - 2007-02-16 : 12:51:23
Lets say I have a table with 85 columns, all of the allow nulls except the id column. When writing a stored procedure for doing an insert, is there a way around specifying a prameter for each and every column ? Only thing I can think of is to pass in an xml document and have the procedure loop through, grabbing the values it needs to do the insert.

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-02-16 : 12:58:07
As long as the other columns allow nulls, just specify a column list with the columns you are going to give non-null values for, something like this

INSERT tablename (id) VALUES (12345)
Go to Top of Page
   

- Advertisement -