Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I want to copy some rows from Table tblA to Table tblB But my code is not working, help
ALTER PROCEDURE [dbo].[BulkInsert] ASDeclare @var1 char(10)Declare @var2 char(10)Declare @Var3 char(10)BEGINInsert Into TblB(var1,Var2,Var3) (Select Var1,Var2,Var3 From tblA)FETCH NEXT INTO @var1,@Var2,@Var3END
Chris
afrika
Master Smack Fu Yak Hacker
2706 Posts
Posted - 2005-06-23 : 13:17:58
code
Insert Into TblB(var1,Var2,Var3)values (Select Var1,Var2,Var3 From tblA)
rockmoose
SQL Natt Alfen
3279 Posts
Posted - 2005-06-23 : 14:46:01
That is wrong syntax Afrika.INSERT TblB(var1,var2,var3)SELECT var1,var2,var3FROM TblAWHERE <criteria to select the rows You want from TblaA>Chris, please, You really don't need a cursor to do this.rockmoose
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2005-06-24 : 01:37:04
In Books On Line , Go to Index and Type Insert into. You can see how to copy from one table to otherMadhivananFailing to plan is Planning to fail