Ever wanted to copy a table to another database in Sql Server, including the data ?
Well there are several options like for example the Copy Database Wizard, the Import/Export Wizard, Integration Services, … But as from Sql Server 2008 there's a new, not very well documented option: The Generate Scripts Wizard.
Right click on a database in Sql Server Management Studio 2008 and select Generate Scripts:
Then select the database, and in the next screen select what you would like to script, like for example Data (which is not selected by default):
Then select the object(s) you would like to script:
Now, choose how you would like the script to be generated:
And voila:
INSERT [dbo].[CRONUS International Ltd_$Customer]
([No_], [Name], [Search Name], [Name 2], [Address], [Address 2], [City], [Contact], [Phone No_], [Telex No_], [Our Account No_], [Territory Code], [Global Dimension 1 Code], [Global Dimension 2 Code], [Chain Name], [Budgeted Amount], [Credit Limit (LCY)], [Customer Posting Group], [Currency Code], [Customer Price Group], [Language Code], [Statistics Group], [Payment Terms Code], [Fin_ Charge Terms Code], [Salesperson Code], [Shipment Method Code], [Shipping Agent Code], [Place of Export], [Invoice Disc_ Code], [Customer Disc_ Group], [Country_Region Code], [Collection Method], [Amount], [Blocked], [Invoice Copies], [Last Statement No_], [Print Statements], [Bill-to Customer No_], [Priority], [Payment Method Code], [Last Date Modified], [Application Method], [Prices Including VAT], [Location Code], [Fax No_], [Telex Answer Back], [VAT Registration No_], [Combine Shipments], [Gen_ Bus_ Posting Group], [Picture], [Post Code], [County], [E-Mail], [Home Page], [Reminder Terms Code], [No_ Series], [Tax Area Code], [Tax Liable], [VAT Bus_ Posting Group], [Reserve], [Block Payment Tolerance], [IC Partner Code], [Prepayment %], [Primary Contact No_], [Responsibility Center], [Shipping Advice], [Shipping Time], [Shipping Agent Service Code], [Service Zone Code], [Allow Line Disc_], [Base Calendar Code], [Copy Sell-to Addr_ to Qte From])
VALUES
(N'01121212', N'Spotsmeyer''s Furnishings', N'SPOTSMEYER''S FURNISHINGS', N'', N'612 South Sunset Drive', N'', N'Miami', N'Mr. Mike Nash', N'', N'', N'', N'FOREIGN', N'SALES', N'', N'', CAST(0.00000000000000000000 AS Decimal(38, 20)), CAST(0.00000000000000000000 AS Decimal(38, 20)), N'FOREIGN', N'USD', N'', N'ENU', 0, N'1M(8D)', N'2.0 FOR.', N'JR', N'EXW', N'', N'', N'01121212', N'', N'US', N'', CAST(0.00000000000000000000 AS Decimal(38, 20)), 0, 0, 0, 1, N'01454545', 0, N'', CAST(0x00009C6500000000 AS DateTime), 0, 0, N'YELLOW', N'', N'', N'', 1, N'EXPORT', NULL, N'US-FL 37125', N'', N'spotsmeyer''[email protected]', N'', N'FOREIGN', N'', N'', 0, N'EXPORT', 1, 0, N'', CAST(0.00000000000000000000 AS Decimal(38, 20)), N'', N'', 0, N'', N'', N'X', 1, N'', 0)
…
Comments