1

Is it possible to generate scripts but not for all tables ? I want to generate scripts in D:\Folder\.

Query

select * 
from DatabaseA.dbo.TableA
where model = 'animal_b'
2
  • Generate script for the table schema or data in the table? Commented Mar 20, 2014 at 10:56
  • 1
    You can use Generate Scripts option of the SQL Server Commented Mar 20, 2014 at 11:02

2 Answers 2

1

It is not possible to have SQL Server Mangement Studio script only some of the records in a table, based on a filter. When scripting data, it's all or nothing.

What you can do, is copy the records into a new table, by doing something like this:

select * 
into DatabaseA.dbo.TableA_Copy
from DatabaseA.dbo.TableA
where model = 'animal_b'

And then simply script the data of TableA_Copy.

Sign up to request clarification or add additional context in comments.

1 Comment

Glad to be of help. In case you don't have permissions to create a new table, either copy the data to a new table in a database where you have permission, or use the Import/Export-wizard as suggested elsewhere, to transfer the data to another server.
0

May be if you want to get limited data basing on where condition from your table then execute select statement then

RIGHT CLICK >> COPY with Headers and paste into Excel Sheets 

>> Click on EXPORT IMPORT Wizard >>
>>Tick on Tab 
>>Tick on Text 

you will get the same format as shown in Sql Editor

1 Comment

The original question is to generate scripts (ie a script of INSERT statements) not to extract the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.