[quoted text, click to view] User wrote: > I have a table with 30 columns. > > I want to insert a value of "0" into the columns
Are you sure you're not violating 1NF? http://en.wikipedia.org/wiki/1NF#Multiple_columns_representing_the_same_type_of_fact [quoted text, click to view] > I do not wish to do a > > insert into table (col1,col2,col3.....col3) values(0,0,0,0,0,0,......0) > > as it is a very painful process. One comma missing and it's going to hurt my > eyes. > > Are there any short cuts to do the above: insert "0" to all the columns to a > new row?
Surely this is overkill. Just format the statement something like this: insert into table ( col01, col02, col03, col04, col05, col06, col07, col08, col09, col10, col11, col12, col13, col14, col15, col16, col17, col18, col19, col20, col21, col22, col23, col24, col25, col26, col27, col28, col29, col30 ) values ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Hi, I have a table with 30 columns. I want to insert a value of "0" into the columns I do not wish to do a insert into table (col1,col2,col3.....col3) values(0,0,0,0,0,0,......0) as it is a very painful process. One comma missing and it's going to hurt my eyes. Are there any short cuts to do the above: insert "0" to all the columns to a new row? pls advise, Thanks Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ----------------------------------------------------------
You could use replicate and copy the output for your select. select replicate('0,', 30) Will return 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, Remove the last comma [quoted text, click to view] User wrote: > Hi, > > I have a table with 30 columns. > > I want to insert a value of "0" into the columns > > I do not wish to do a > > insert into table (col1,col2,col3.....col3) values(0,0,0,0,0,0,......0) > > as it is a very painful process. One comma missing and it's going to hurt my > eyes. > > Are there any short cuts to do the above: insert "0" to all the columns to a > new row? > > pls advise, > > Thanks > > > > Posted Via Usenet.com Premium Usenet Newsgroup Services > ---------------------------------------------------------- > ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** > ---------------------------------------------------------- > http://www.usenet.com
You could use replicate and copy the output for your select. select replicate('0,', 30) Will return 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, Remove the last comma [quoted text, click to view] User wrote: > Hi, > > I have a table with 30 columns. > > I want to insert a value of "0" into the columns > > I do not wish to do a > > insert into table (col1,col2,col3.....col3) values(0,0,0,0,0,0,......0) > > as it is a very painful process. One comma missing and it's going to hurt my > eyes. > > Are there any short cuts to do the above: insert "0" to all the columns to a > new row? > > pls advise, > > Thanks > > > > Posted Via Usenet.com Premium Usenet Newsgroup Services > ---------------------------------------------------------- > ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** > ---------------------------------------------------------- > http://www.usenet.com
Don't see what you're looking for? Try a search.
|