Refactor Select into as Create table and Insert.

Hello,

Is there a built in way to refactor this kind of statement...
SELECT ID, Name, Job INTO #Employee FROM Employees
into something like this?
CREATE TABLE #Employee (ID int, Name varchar(max), Job varchar(max))<br>INSERT INTO #Employee <br>    SELECT ID, Name, Job<br>    FROM Employees<br>
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.

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.
Tagged:

Answers

Sign In or Register to comment.