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 |
Patyk
Yak Posting Veteran
74 Posts |
Posted - 2014-08-12 : 19:55:55
|
I need to insert a record in a table which has about 90 columns.My first column is a CustCode that would be supplied by parameter all other columns should be set to 0Is there a quick way of doing this?Thanks |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-08-12 : 21:28:36
|
[code]insert into myTable (CustCode)select @CustCode[/code]This assumes that all other columns have default values or can accept NULL values. |
 |
|
Patyk
Yak Posting Veteran
74 Posts |
Posted - 2014-08-14 : 12:17:52
|
this will insert the record, my CustCode is OK, all other columns are null. I want them to be 0 instead. There are many columns all should be Zero. |
 |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-08-14 : 12:25:27
|
Then, you'll have to specify them all if they don't have defaults. |
 |
|
Patyk
Yak Posting Veteran
74 Posts |
Posted - 2014-08-14 : 12:28:31
|
Could there may be a loop for column 1 to the end insert Zero? |
 |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-08-14 : 12:37:04
|
no |
 |
|
|
|
|