Avatar of ITCSAdmin
ITCSAdmin
Flag for United States of America asked on

How do I create SQL Script to create SQL table including Data for SQL 2008

How do I create SQL Script to create SQL table that includes Data for for an existing SQL 2008 Table. I need this to be able to add the script to my Visual Studio 2008 SQL.txt file for when I publish the project, I havelooked all over the MSDN Library and have NOT been able to find what I am looking for, especially since I do not know the terminology.
Microsoft SQL ServerMicrosoft SQL Server 2008

Avatar of undefined
Last Comment
Raja Jegan R

8/22/2022 - Mon
Eladla

The command you are looking for is:
create table as select...
Here is an example:
http://www.faqs.org/docs/ppbook/r25329.htm
YYatin

Follow below steps
- execute create table query
- run below query in SQL manager for each table ( convert all numeric fields into varchar )
- copy all result in script file and execute each in the script
select 'insert into tUser (uId,uName) values ('+convert(varchar,uId)+','+uName+')' from tUser

Open in new window

ASKER CERTIFIED SOLUTION
Raja Jegan R

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ITCSAdmin

ASKER
Was exactly what I wanted and it actually worked too.
Thanks

ITCS Admin
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Raja Jegan R

Welcome..