Autogenerate variables based on correlated field
When writing SQL, I frequently will create a variable within the statement before I have Declared the variable. It would be great if SQL Prompt offered a UI option to autogenerate the variable declaration.
For example, given the statement:
SELECT * FROM dbo.Person WHERE Username = @Username
I would like to use a shortcut key to auto generate and insert the declaration above the statement:
DECLARE @Username VARCHAR(8);
For simple fields, the data type can be pulled directly from the field metadata. For expressions, derive the data type as SQL would if possible, or move the cursor to the data type field in the declaration.
This would save a lot of time spent typing, as well as reducing data errors by deriving the correct data type from the underlying field.