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

Totally Dumb Dev Question Expand / Collapse
Author
Message
Posted Thursday, December 18, 2008 7:58 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, October 4, 2012 9:20 AM
Points: 583, Visits: 1,060
One dev just asked me

"If you have a table with an autogen id column, and a datetime column which defaults to now() (dev speak for CURRENT_TIMESTAMP :) ) can you just insert rows without adding anything else?"

Hmmm I thought sounds bizzare insert a row without adding any other data................

I don't think it would work.... how do you do the insert?

You have to add something to the row to get it to generate an instance of a row and bind it to the table. i.e. a data item into a third column.

(Time to educate with extreme predjudice) :D

--Shaun


Hiding under a desk from SSIS Implemenation Work
Post #622104
Posted Thursday, December 18, 2008 8:02 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:05 AM
Points: 7,208, Visits: 13,666
Hi Shaun

Wasn't this a qotd earlier in the year?

INSERT INTO table Default Values


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #622111
Posted Thursday, December 18, 2008 8:10 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, October 4, 2012 9:20 AM
Points: 583, Visits: 1,060
Can't say I saw that one Chris, but I'll go check it out cheers.

So it is possible using

INSERT INTO 'tablename' Default Values

Amazing :D Them devs are not so dumb afterall. :P

--Shaun


Hiding under a desk from SSIS Implemenation Work
Post #622119
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse