SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Totally Dumb Dev Question


Totally Dumb Dev Question

Author
Message
Shaun McGuile
Shaun McGuile
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1125 Visits: 1060
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 Smile ) can you just insert rows without adding anything else?"

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

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) BigGrin

--Shaun

Hiding under a desk from SSIS Implemenation Work Crazy
ChrisM@Work
ChrisM@Work
SSC-Forever
SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)

Group: General Forum Members
Points: 42232 Visits: 20012
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
Shaun McGuile
Shaun McGuile
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1125 Visits: 1060
Can't say I saw that one Chris, but I'll go check it out cheers.

So it is possible Crazy using

INSERT INTO 'tablename' Default Values

Amazing BigGrin Them devs are not so dumb afterall. Tongue

--Shaun

Hiding under a desk from SSIS Implemenation Work Crazy
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search