All Questions
21 questions
12
votes
1
answer
5k
views
Why does SQL Server Management Studio not script indexes by default?
Recently I realized by default, scripting the database does not including indexes, and I have to change the option every time.
Could anyone please explain the reason? Is there any insight about this ...
2
votes
1
answer
367
views
How to order databases by size? (For use in full backups)
Recently, I've been trying to make our company's full backup process more efficient. In order to do this, my team has decided that instructing the backup job to tackle the full backups starting with ...
2
votes
1
answer
302
views
My SSMS is bringing wrong object in "Script Stored Procedure as" > "CREATE To" > "New Query Editor Window"
When I go to Object Explorer and expand down to Stored Procedures (or Tables), right-click on one of them and choose "Script Stored Procedure / Table as" > "CREATE To" > "New Query Editor Window", it ...
0
votes
1
answer
35
views
How to migrate a database from 2016 to 2014 if there are encrypted/locked objects(SPs) associated with it?
I am trying to migrate a database from 2016 to 2014 through Task-->Generate Scripts. There are some stored procedures that are locked and seems like they are encrypted as well. They are causing ...
1
vote
1
answer
288
views
Cannot script stored procedure while restoring another copy of current db
I have some large DB that I need to restore to another db from time to time, this process take some time to conclude. The annoying thing I found out in last version of SSMS is that I cannot script any ...
1
vote
4
answers
5k
views
Error "the system cannot find the file specified" when opening a large SQL Server file
I have generated the script of my whole SQL Server database into a file and it's more than 36 GB. When I try to open it, I get the following error:
The system cannot find the file specified.
At ...
0
votes
2
answers
6k
views
Set default value for all columns with specific name within a database
I've got a database that includes an int column project_id on many tables, and I want to script setting the default value to a specific value for all columns with that name in the database. Note that ...
0
votes
1
answer
174
views
Can I ignore queries about extendedproperty?
I want to reuse the structure of a database in a new project. So using SSMS I use Generate Script and in settings I set to generate schema only.
In the result there are too many queries about ...
1
vote
1
answer
3k
views
Generate script for SQL Broker objects
I'm using SQL Server Management Studio to generate scripts for all the objects in an existing database:
but the objects related to SQL Broker (messages, queues and services) are not generated.
I've ...
13
votes
1
answer
6k
views
Does SQL Server / T-SQL support line-continuation to break up long strings?
I sometimes have a SQL script that has one or more super-long (sometimes even stupid-long) strings. Typically these are VARBINARY literals / constants that represent files / Assemblies, but ...
1
vote
0
answers
90
views
How to save SSMS 2012 Object Explorer Scripting Settings?
I'm generating a bunch of object creation scripts in SSMS 2012, using the Object Explorer context menu. The default options for these generated scripts are not to my liking (for example, I want the ...
2
votes
1
answer
7k
views
Generating script in SQL server taking too long [closed]
I am making backup for my tables in the database and I am generating scripts (from task) in SQL Server Management Studio.
There's about 30-40 tables that I am interested to backup including ...
5
votes
2
answers
1k
views
SSMS constraint script: Purpose of second alter table statement?
SSMS scripts Foreign Key constraints as two statements:
ALTER TABLE {table}
WITH CHECK
ADD CONSTRAINT {constraintname} {constraint spec}
GO
ALTER TABLE {table}
CHECK CONSTRAINT {constraintname}
GO
...
0
votes
0
answers
112
views
SQL Server 2008 R2 warning when tried to execute the script of size approx 500MB [duplicate]
When I tried executing a SQL script, which was of 500MB approx. Management Studio throws an error
Insufficient memory to continue the execution of the program
My system memory is 8GB and only 3GB ...
3
votes
1
answer
4k
views
How to clone a table schema (including indices) in SQL Server?
Is there a command that will completely clone the schema of a table? This would include all constraints, foreign keys, and indices on the table.
In SSMS the Script Table as | Create To menu command ...
2
votes
3
answers
956
views
What is the point of the Script Date in a stored procedure script generated by SSMS?
When I generate a stored procedure script, SSMS additionally generates a comment containing the name of the object and a Script Date timestamp:
The timestamp is just the current time at the moment ...
10
votes
2
answers
29k
views
How to script all permissions on a schema
SQL management studio allows to create scripts for all db objects, however I so far couldn't find a way to correctly script a schema or user. The permissions of a user on a schema are not included in ...
1
vote
0
answers
244
views
How to investigate non-specific Generate and Publish Scripts Wizard errors
I am trying to use the Generate and Publish Scripts wizard in SSMS 2012 against a 2012 SQL instance and am getting errors. Trying to generate a schema-only script of the tables and schemas. I allowed ...
2
votes
1
answer
269
views
How to script a table? [duplicate]
When I right-click a table in Object Explorer and click "Script Table" I can get SSMS to script my table.
Can I do that with T-SQL code?
I'm after the "CREATE TABLE xx" code that SSMS generates, so ...
9
votes
1
answer
3k
views
Executing TSQL script generated from SSMS in SQLCMD. Failing on quotes
I am attempting to deploy a database to a machine by executing a script generated by the "Generate Scripts" tool in SQL Server Management Studio.
Here is the command I've issued:
sqlcmd -S ...
4
votes
4
answers
6k
views
how to turn off delimiters in generated SQL scripts for data types in SQL Server Management Studio
We are a software engineering firm. We use SQL Server Management Studio (SSMS) to generate the few scripts we need to build and upgrade our databases.
While it does an OK job, it bugs me that it ...