SQL Server Table with data

Archived from the original Sajha.com — preserved as posted, replies can no longer be added here.
Start a New Discussion
Archived Post

Hello sajha guruharu, I have a table.  I want to generate the create skript with data without right-clicking on the table.  What can be the skript to generate the SQL Server Table with data? Please help. Thanks in advance. Last edited: 28-Jul-19 01:21 PM

phone · Jul 25, 2019 4:21 PM · 16,991 views

5 Replies

SELECT * FROM TABLENAME That will give you data. lol

neo-reactive-poet · Jul 25, 2019 9:55 PM

Right click on the Database, go to Generate skript, inside 'advanced' ( I believe) it says 'schema' and 'Schema and Data' select 'Schema and Data' one.Or  SELECT * INTO newtable (it will create a new table)FROM tableName (you want to create a table using this table data) Hope it helps. Last edited: 27-Jul-19 08:35 AM

smtzac · Jul 27, 2019 8:29 AM

Hello smtzac, Thank you for your reply. Is there a query to generate a query as an alternative by going into the database>tasks>generate skript.......? Thank you. Last edited: 28-Jul-19 01:23 PM

phone · Jul 28, 2019 8:41 AM

No, I don't believe so. Last edited: 28-Jul-19 09:22 AM

smtzac · Jul 28, 2019 9:16 AM

Copy the result set from the following query and patch with INSERT INTO dbo.DestinationTable(ColumnA,ColumnB) SELECT 'SELECT '+ ''+ColumnA+''+','+''+ColumnB+''+' UNION ALL' FROM dbo.TableName

Jhilke_Bro · Jul 29, 2019 11:00 AM

This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.

Start a New Discussion