I am using SQL Server 2008 R2 Express Edition. I am trying to copy data from master.Lic
table to mydb.Lic
table. Following is the query.
insert into mydb.dbo.Lic
("key",value)
select "key",value from master.dbo.Lic
If I execute above query from the Visual Studio's SQL query prompt it works!!
However, when I am trying the same query using SQLCMD
I am facing following error:
Msg 102, Level 15, State 1, Server NB\SQLEXPRESS, Line 2
Incorrect syntax near 'value'.
Need suggestion on how this can be done using SQLCMD on the user machine I can use only SQLCMD.
EDIT:
Command to connect SQLCMD
C:\WINDOWS\system32>sqlcmd -S .\sqlexpress
1> use mydb
2> go
Changed database context to 'mydb'.
Correct Query:
insert into dbo.SoftwareLicence
([key],[value])
select [key],[value] from master.dbo.SoftwareLicence