Friday 31 July 2015

SQL Azure - Statement ‘SELECT INTO’ is not supported in this version of SQL Server.

Select Into With SQL Azure
I am getting error in sql server management studio
Msg 310, Level 15, State 2, Line 1
Statement ‘SELECT INTO’ is not supported in this version of SQL Server.

Solution:
Well, As we all know SQL Azure table must have a clustered index, that is why SELECT INTO failure copy data from one table in to another table.
If you want to migrate, you must create a table first with same structure and then execute INSERT INTO statement.
For temporary table which followed by # you don;t need to create Index.


Old Syntax
select * into #tempCopytable from tab_users


Solution
Create table #tempCopytable (id int, name varchar(max), email varchar(max))
Insert into #tempCopytable (id,name,email) select * from tab_users

or

create table Copytable
(
id int not null identity constraint pk_id primary key clustered ,
name varchar(max),
email varchar(max)
)
Insert into Copytable (name,email) select * from tab_users


Reference url http://azure.microsoft.com/blog/2010/05/04/select-into-with-sql-azure/