14 results found
-
Highlight a SELECT stmt and create a temp table definition from it.
Highlight a SELECT stmt and create a temp table definition from it. You often need to create #tables and you have a select to fill it with. However, you have to either create the #table manually or do a SELECT INTO into a real table and then script it out. It would be nice to be able to just take my SELECT and be able to get the #table definition for it.
31 votes -
Choose to have ALTER instead of CREATE scripts
When I hover over an object and get the pop-up script for that object (proc/view/function) I would like the ability to have the script default to ALTER instead of CREATE.
99.9% of the time I manually have to edit the Create to be an Alter, this would save SO MUCH time.
14 votes -
refactor SELECT into CTE
The way I work when creating complicated scripts is creating all the SELECT statements and then convert them to CTEs of my final query.
It would be nice if you could convert SELECT into CTE7 votes -
Create a table variable from a table
Very often I need to create a temp table, table variable, or UDTT that is a duplicate or subset of an existing table. I'd like the @table definition to include primary key and unique constraints and any check constraints and default constraints that are in the actual table. No foreign key constraints obviously. SSMS object scripting botches this up by creating a bunch of alter statements instead of including constraints inside the CREATE statement.
7 votes -
Script object as alter also in 'CREATE OR ALTER' statement
'Script object as alter' (F12) works in ALTER statements but not in CREATE OR ALTER statements like. It would be nice if it also worked for the latter.
Example:
'CREATE OR ALTER VIEW [MyView] AS SELECT 1 AS Col1;'
If I right-click on [MyView] in the above code snippet and select 'Script object as ALTER' (or hit F12), I would expect SQL Prompt to script the object if it exists.
Currently nothing happens.5 votes -
script insert as
Today’s mail from https://sqlquantumleap.com/2019/05/09/maximum-number-of-rows-for-the-table-value-constructor/
Shows as way around the 1000 rows limitation on the VALUES ()… statement.Please enhance SQL Prompts “Script as Insert” feature to use this method.
Currently SQL Prompt is scripting it like this, when the results window has more than 1000 rows:
CREATE TABLE #temptable( [id_user] int, [RowCnt] int, [mt] datetime)
INSERT INTO #temptable
VALUES
( 372, 2,N'2012-09-01T00:00:00')
INSERT INTO #temptable
VALUES
( 196, 2,N'2012-09-01T00:00:00')
INSERT INTO #temptable
VALUES
( 210, 2,N'2012-09-01T00:00:00')
…It can be done like this:
CREATE TABLE #temptable( [iduser] int, [RowCnt] int, [mt] datetime)
INSERT INTO #temptable
select *
from(
values…5 votes -
Script as Insert
With the Script as INSERT feature, give the option to just copy the CREATE TABLE and INSERT INTO statements to the clipboard.
I regularly create Temp Tables to store query results when working through a SPROC. (Generate a dataset, throw it in a temp table to use for later, drop it at the end of the SPROC. More efficient than doing one massive Select with Subqueries.) When you Script as INSERT, that's created in a new tab. I copy that code and go back to the original tab.
Would be convenient if I could copy straight to the clipboard and…
4 votes -
Script as Insert #tempTable to snippet/placeholder text
When using the Script as Insert, it generates the Create Table with the table name as
#temptable
. If you want to change that name, you have to then change it in the Create, Insert, and Drop locations.
Would be nice if this defaulted as a snippet placeholder so that editing one would edit the other two as well.3 votes -
Show synonym script on F12
I would like to see the Script Object as Alter (F12) feature to work with synonyms. However, I am aware that a synonym cannot be altered - instead I suggest to generate a script containing a DROP and a CREATE statement.
That way one could bring up the code of the referenced object by selecting the synonym, pressing F12, selecting the referenced object and pressing F12 again.
3 votes -
Computed Column Update process
Occasionally I must edit the definition of a computed column. As editing a computed column is not allowed from SQL, would be nice to generate a script that would facilitate this update, similar to the rename script. (Ie, drops indexes, drops the field, recreates the field, and recreates the indexes.)
Obviously this is similar to the functionality of the Smart Rename, except doesnt' have to edit Views and Sprocs, so hopefully most of the logic could quickly copy over from there!
2 votes -
F12 to Create Table Script
F12 to Script views and stored procedures as ALTER is one of my favorite features. I would love it if F12 when I am on a table generates a CREATE TABLE script for that table.
2 votes -
Name tab with object name when scripting from Object Explorer
When scripting an object from the Object Explorer, for example with right-click -> Modify or Script as... CREATE To, the tab created has a default name determined by SSMS, for example "SQLQuery45 - database01.sql". It would be great if this naming was the same as when you click F12 on an object name in a script, where the new tab is named the same as the object, for example "dbo.SomeStoredProcedure - database01.sql".
2 votes -
Script object as alter from the Object Explorer
Would like the option to Script Object as Alter (F12) from the Object Explorer pane. So, for example, when I click on a stored procedure in the Object Explorer and click F12 (or right click and select Script Object as Alter), it would open a new tab with the stored procedures scripted as alter.
2 votes -
Suggestions window should display CREATE sql for CLR objects
No CREATE SQL is displayed in the suggestions window when hovering over any CLR objects, or scripting the object as alter. The code returned is just a comment saying:
-- No creation SQL available for this object type
The CREATE/ALTER statement can easily be built by querying the relevant system tables. SSMS does it when you script the object and other Redgate products such as SQL Compare and SQL Source Control do it just fine, not sure why SQL Prompt would have been left out.
1 vote
- Don't see your idea?