By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,526 Members | 2,189 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,526 IT Pros & Developers. It's quick & easy.

Copy Table From One Table To Another Table In SQL Server

P: 1
Hi All,

I Want To Copy Table Data From One Table To Another Both Table Name Are Same But in Other Database
I Tried This

Expand|Select|Wrap|Line Numbers
  1. SELECT * INTO DIMS1.dbo.MstCmp
  2.  FROM DIMS.dbo.MstCmp where 1>2
But This Doesn't Work When Both Tables Are Same

So Please Help Me Out For This.

Thanks And Regards..
Sep 15 '10 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 15k+
P: 31,399
That would never work in any circumstances as your WHERE clause specifies to copy only when 1 is greater than 2 (which is by definition FALSE).
Sep 15 '10 #2

Expert 2.5K+
P: 2,878
To add to Neo's response...

Your command will copy the table, but not the content, not the index, not the trigger, not any constraint, just the structure. You'll have an empty table...

Happy Coding!!!

~~ CK
Sep 15 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.