happy 1001
asked on
Step by step process for creating SQL Script for Demo Table in SQL Server
Suppose that the "Employee Table" as shown in the attached snapshot, is actually present inside my SQL Server Database.Now I have to ask some question regarding this table, therefor I want to post a SAMPLE of this table on some Database Help Forum.
My question is - how do I prepare the SQL Script for doing this work in the most simple manner ? Just as the code shown in the snapshot has various parts - Create Database, Create Table, Insert Into. If we run this code in SQL Server then we will get the exact table as an output.
Please give me the simplest method to prepare such SQL Script for any table present in my SQL Server Database.I hope I do not have to Manually Write the "Create Table and Insert Into" parts for creating such SQL Scripts.
Thanks a lot for your help.
PS: I have taken that snapshot from this article - http://sqlhints.com/2014/02/08/querying-data-using-select-in-sql-server/
Please do not be confused by any other material given in that article. Our interest is ONLY in the very first snap given on the very top which shows the script for creating the Employee Table.
My question is - how do I prepare the SQL Script for doing this work in the most simple manner ? Just as the code shown in the snapshot has various parts - Create Database, Create Table, Insert Into. If we run this code in SQL Server then we will get the exact table as an output.
Please give me the simplest method to prepare such SQL Script for any table present in my SQL Server Database.I hope I do not have to Manually Write the "Create Table and Insert Into" parts for creating such SQL Scripts.
Thanks a lot for your help.
PS: I have taken that snapshot from this article - http://sqlhints.com/2014/02/08/querying-data-using-select-in-sql-server/
Please do not be confused by any other material given in that article. Our interest is ONLY in the very first snap given on the very top which shows the script for creating the Employee Table.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your help Koen Van Wielink. I was using a similar method as you described, but that involved multiple steps and I had to do copy paste work every time.
The solution provided by Deepak solves that trouble.
Thanks for your reply.
The solution provided by Deepak solves that trouble.
Thanks for your reply.
ASKER
That is exactly what I was looking for. This solution works perfectly for my needs. Your answer was short and to the point. The snapshot and the highlighted portion proved out to be very helpful.
Thanks again