SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Powershell Script for regular DBA activities_GenerateScripts


Powershell Script for regular DBA activities_GenerateScripts

Author
Message
er.mayankshukla
er.mayankshukla
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3850 Visits: 588
Comments posted to this topic are about the item Powershell Script for regular DBA activities_GenerateScripts
RandomStream
RandomStream
SSCrazy
SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)

Group: General Forum Members
Points: 2953 Visits: 648

Why do you need to script this table?


er.mayankshukla
er.mayankshukla
Hall of Fame
Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)Hall of Fame (3.9K reputation)

Group: General Forum Members
Points: 3850 Visits: 588
The table I had mentioned is just for an example.
It shows the functionalities that you get if you wish to script a table might be for testing on local environment with limited set of data
RandomStream
RandomStream
SSCrazy
SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)

Group: General Forum Members
Points: 2953 Visits: 648
What is I want to script a long list of tables but not all tables?
It would be helpful if you could allow user to populate a target file with all answers supplied.

For instance:

<target
ServerName="myserver",
Database="mytestdb",
SchemaFlag="Y",
DataFlag="Y",
IndexFlag="Y",
ForeignKeyFlag="Y",
...>
<TableList Schemaname="DBO">table1, table2</TableList>
<TableList Schemaname="Finance">fin_table1, fin_table2</TableList>
<TableList Schemaname="Sales">sales_table1, sales_table2</TableList>
</target>

Aubrey Love
Aubrey Love
SSC Rookie
SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)

Group: General Forum Members
Points: 32 Visits: 79
RandomStream - Monday, January 8, 2018 10:55 AM
What is I want to script a long list of tables but not all tables?
It would be helpful if you could allow user to populate a target file with all answers supplied.

For instance:

<target
ServerName="myserver",
Database="mytestdb",
SchemaFlag="Y",
DataFlag="Y",
IndexFlag="Y",
ForeignKeyFlag="Y",
...>
<TableList Schemaname="DBO">table1, table2</TableList>
<TableList Schemaname="Finance">fin_table1, fin_table2</TableList>
<TableList Schemaname="Sales">sales_table1, sales_table2</TableList>
</target>

Ditto: And what if I wanted to generate scripts of all tables in a database? I see that this does not work on views - only on tables, or am I doing something wrong?
With that aside, Great article. It is simple to use and it actually works right out of the box. So many samples I see online don't work and require a bit of tweaking or a complete re-write of the code. But on this site, things just work!
And that's why I love this web-site.
It's my one-stop-shop for all things SQL.

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search