Refactor Select into as Create table and Insert.
cmcpheron
Posts: 1 New member
in SQL Prompt
Hello,
Is there a built in way to refactor this kind of statement...
SELECT ID, Name, Job INTO #Employee FROM Employeesinto 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
There isn't a built-in way at the moment, I'm sorry to say.
Can you please post a request for this on our uservoice forum: https://redgate.uservoice.com/forums/94413-sql-prompt
Thank you!
Jessica Ramos | Product Support Engineer | Redgate Software
Have you visited our Help Center?