Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

insert a table row where every column has a default Expand / Collapse
Author
Message
Posted Wednesday, May 13, 2009 4:10 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 9, 2009 9:06 AM
Points: 5, Visits: 31
A co-worker just asked me a question, that got my head scratching. How do you insert a row in a table, where every column has a default value. He doesn't want to supply any data, just insert a row and let the defaults take over.

Can something like this be done? What's the syntax?

TIA
Andre

Post #716525
Posted Wednesday, May 13, 2009 4:25 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 10:27 AM
Points: 4,009, Visits: 6,075
--
INSERT INTO T1 DEFAULT VALUES;
--


This is right out of the examples in Books Online for the INSERT statement. Sometimes it's as easy to RTFM as it is to ask a forum.


__________________________________________________

Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? -- Stephen Stills
Post #716537
Posted Wednesday, May 13, 2009 4:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 9, 2009 9:06 AM
Points: 5, Visits: 31
You got me there. My bad.
Post #716538
Posted Thursday, May 14, 2009 12:50 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 10:27 AM
Points: 4,009, Visits: 6,075
No problem. Hope you didn't mind me poking a little fun.

__________________________________________________

Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? -- Stephen Stills
Post #717285
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse