Rx_
Nothing In Moderation
- Local time
- Today, 08:44
- Joined
- Oct 22, 2009
- Messages
- 2,803
Here is one way to create a TSQL script for posting a Table Creation with Insert Data (and values) for testing SQL Server scripts on a forum.
If anyone else has a method, please share!
I am guilty of going to SQL Server Central Forums and posting questions as a Newbie. SQL Server Central - SQL Server Newbies
They are always (understandable) asking for the Sample Table data.
My response was to Fake some SQL. However that gets tiresome if there are 30 records with ten columns needed to post SQL text as an example.
Since I only spend 17.3842% (or there about) of my time in SQL Server, there is always something to learn. As I am asking another question today, it was worth learning one method to try and save what is left of my Warnings to comply with the Requirements for Asking Questions.
Here are the steps with an attachment that worked for me. Perhaps someone else can share any different methods to accomplish the same thing?
In SSMS (SQL Server Management Studio) Object Explorer:
1. Right click on the database Object
2. Choose Tasks
3. Select Generate Scripts - (There are several NEXT in this Wizard to choose)
4. Choose tables
5. Click advanced (KEY STEP)
6. Scroll to Data to Script [Or Types of Data to Script for SQL 2014]
7. Select data only (experiment with some other choices)
8. Click next and generate your script
Note: Step 7 Shows Data only, but the result in the attachment of Create Table and Insert With Data was the both option.
My non-default preference is to save results in a New Query Window.
If anyone else has a method, please share!
I am guilty of going to SQL Server Central Forums and posting questions as a Newbie. SQL Server Central - SQL Server Newbies
They are always (understandable) asking for the Sample Table data.
My response was to Fake some SQL. However that gets tiresome if there are 30 records with ten columns needed to post SQL text as an example.
Since I only spend 17.3842% (or there about) of my time in SQL Server, there is always something to learn. As I am asking another question today, it was worth learning one method to try and save what is left of my Warnings to comply with the Requirements for Asking Questions.
Here are the steps with an attachment that worked for me. Perhaps someone else can share any different methods to accomplish the same thing?
In SSMS (SQL Server Management Studio) Object Explorer:
1. Right click on the database Object
2. Choose Tasks
3. Select Generate Scripts - (There are several NEXT in this Wizard to choose)
4. Choose tables
5. Click advanced (KEY STEP)
6. Scroll to Data to Script [Or Types of Data to Script for SQL 2014]
7. Select data only (experiment with some other choices)
8. Click next and generate your script
Note: Step 7 Shows Data only, but the result in the attachment of Create Table and Insert With Data was the both option.
My non-default preference is to save results in a New Query Window.