Refactor Select into as Create table and Insert.
Is there a built in way to refactor this kind of statement...
into something like this?
SELECT ID, Name, Job INTO #Employee FROM Employees
The PE003 rule keeps triggering on these statements but it takes an annoyingly long time to write out the column definitions by hand for longer tables.
CREATE TABLE #Employee (ID int, Name varchar(max), Job varchar(max))
INSERT INTO #Employee
SELECT ID, Name, Job
As a work around, I found that I can run the select statement, select the first row, then Right Click > 'Script as Insert' and that will get me most of the way, but that also requires more steps than the usual refactoring options.
0 · Share on Twitter