Question on SQL syntax
-
I am trying to move some records from table A to table B. This is what I have thus far:
declare @PartID varchar(50), @SectionNumber varchar(50), @TopWidth float, @BottomWidth float, @boltDiameter float, @pickOrder int Select * from SSVLStandardBracingDesign set @PartID = SSVLSTandardBracingDesign.PartID set @SectionNumber = SSVLStandardBracingDesign.SectionNumber set @TopWidth = SSVLStandardBracingDesign.TopWidth set @BottomWidth = SSVLStandardBracingDesign.BottomWidth set @boltDiameter = SSVLStandardBracingDesign.BracingBoltDiameter set @pickOrder = SSVLStandardBracingDesign.PickOrder insert into BracingKits (PartID, SectionNumber, topWidth, bottomWidth, boltDiameter, pickOrder, S3TL29, S3TLVL, S3TLUL, S3TLMD, S3TLHD, S3TLVH, S3TLUH,S3R, S4TL,S4A, [1200TLWD],[1800TLWD], [1800SRWD], [2400SRWD],[3600SRWD] , [4400SRWD]) VALUES (@PartID, @SectionNumber, @TopWidth, @BottomWidth, @boltDiameter, @PickOrder, 0,1,0,0,0,0,0,0,0,0, 0, 0,0,0,0,0)
I need to set my variables to values from the table. I tried using commas but that didn't work, and my multiple set statements do not work. What is the correct syntax? Thanks! -
I am trying to move some records from table A to table B. This is what I have thus far:
declare @PartID varchar(50), @SectionNumber varchar(50), @TopWidth float, @BottomWidth float, @boltDiameter float, @pickOrder int Select * from SSVLStandardBracingDesign set @PartID = SSVLSTandardBracingDesign.PartID set @SectionNumber = SSVLStandardBracingDesign.SectionNumber set @TopWidth = SSVLStandardBracingDesign.TopWidth set @BottomWidth = SSVLStandardBracingDesign.BottomWidth set @boltDiameter = SSVLStandardBracingDesign.BracingBoltDiameter set @pickOrder = SSVLStandardBracingDesign.PickOrder insert into BracingKits (PartID, SectionNumber, topWidth, bottomWidth, boltDiameter, pickOrder, S3TL29, S3TLVL, S3TLUL, S3TLMD, S3TLHD, S3TLVH, S3TLUH,S3R, S4TL,S4A, [1200TLWD],[1800TLWD], [1800SRWD], [2400SRWD],[3600SRWD] , [4400SRWD]) VALUES (@PartID, @SectionNumber, @TopWidth, @BottomWidth, @boltDiameter, @PickOrder, 0,1,0,0,0,0,0,0,0,0, 0, 0,0,0,0,0)
I need to set my variables to values from the table. I tried using commas but that didn't work, and my multiple set statements do not work. What is the correct syntax? Thanks!You are missing a select statement. Take a peek at the provided link :) http://www.databasejournal.com/features/mssql/article.php/3507171[^] PJC
I'd like to help but I don't feel like Googling it for you.
-
I am trying to move some records from table A to table B. This is what I have thus far:
declare @PartID varchar(50), @SectionNumber varchar(50), @TopWidth float, @BottomWidth float, @boltDiameter float, @pickOrder int Select * from SSVLStandardBracingDesign set @PartID = SSVLSTandardBracingDesign.PartID set @SectionNumber = SSVLStandardBracingDesign.SectionNumber set @TopWidth = SSVLStandardBracingDesign.TopWidth set @BottomWidth = SSVLStandardBracingDesign.BottomWidth set @boltDiameter = SSVLStandardBracingDesign.BracingBoltDiameter set @pickOrder = SSVLStandardBracingDesign.PickOrder insert into BracingKits (PartID, SectionNumber, topWidth, bottomWidth, boltDiameter, pickOrder, S3TL29, S3TLVL, S3TLUL, S3TLMD, S3TLHD, S3TLVH, S3TLUH,S3R, S4TL,S4A, [1200TLWD],[1800TLWD], [1800SRWD], [2400SRWD],[3600SRWD] , [4400SRWD]) VALUES (@PartID, @SectionNumber, @TopWidth, @BottomWidth, @boltDiameter, @PickOrder, 0,1,0,0,0,0,0,0,0,0, 0, 0,0,0,0,0)
I need to set my variables to values from the table. I tried using commas but that didn't work, and my multiple set statements do not work. What is the correct syntax? Thanks!INSERT INTO BracingKits SELECT PartID, SectionNumber, topWidth, bottomWidth, boltDiameter, pickOrder,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 from SSVLStandardBracingDesign
--EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters
-
You are missing a select statement. Take a peek at the provided link :) http://www.databasejournal.com/features/mssql/article.php/3507171[^] PJC
I'd like to help but I don't feel like Googling it for you.
Thank you for the link, that helped. I have another question though that it does not answer. I need to insert some 1's and 0's that are bit fields that don't come from the original table so they are not part of the select statement. This is what I have now:
insert into BracingKits (PartID, SectionNumber, topWidth, bottomWidth, boltDiameter, pickOrder, **S3TL29, S3TLVL, S3TLUL, S3TLMD, S3TLHD, S3TLVH, S3TLUH,S3R, S4TL,S4A, [1200TLWD],[1800TLWD], [1800SRWD], [2400SRWD],[3600SRWD] , [4400SRWD])** SELECT PartID, SectionNumber, TopSread, BottomSpread, BracingBoltDiameter, PickOrder from SSVLSStandardBracingDesign
But all those that are bold need to be the 1/0's. How can I inculde this as part of the statement? -
Thank you for the link, that helped. I have another question though that it does not answer. I need to insert some 1's and 0's that are bit fields that don't come from the original table so they are not part of the select statement. This is what I have now:
insert into BracingKits (PartID, SectionNumber, topWidth, bottomWidth, boltDiameter, pickOrder, **S3TL29, S3TLVL, S3TLUL, S3TLMD, S3TLHD, S3TLVH, S3TLUH,S3R, S4TL,S4A, [1200TLWD],[1800TLWD], [1800SRWD], [2400SRWD],[3600SRWD] , [4400SRWD])** SELECT PartID, SectionNumber, TopSread, BottomSpread, BracingBoltDiameter, PickOrder from SSVLSStandardBracingDesign
But all those that are bold need to be the 1/0's. How can I inculde this as part of the statement?look up CASE statements in SQL that should work.
A man said to the universe: "Sir I exist!" "However," replied the Universe, "The fact has not created in me A sense of obligation." -- Stephen Crane
-
Thank you for the link, that helped. I have another question though that it does not answer. I need to insert some 1's and 0's that are bit fields that don't come from the original table so they are not part of the select statement. This is what I have now:
insert into BracingKits (PartID, SectionNumber, topWidth, bottomWidth, boltDiameter, pickOrder, **S3TL29, S3TLVL, S3TLUL, S3TLMD, S3TLHD, S3TLVH, S3TLUH,S3R, S4TL,S4A, [1200TLWD],[1800TLWD], [1800SRWD], [2400SRWD],[3600SRWD] , [4400SRWD])** SELECT PartID, SectionNumber, TopSread, BottomSpread, BracingBoltDiameter, PickOrder from SSVLSStandardBracingDesign
But all those that are bold need to be the 1/0's. How can I inculde this as part of the statement?Just code in literals:
SELECT PartID, SectionNumber, TopSread, BottomSpread, BracingBoltDiameter, PickOrder, 0, 0, 0, 0, 1, 0, 0, 1, ... from SSVLSStandardBracingDesign
-- modified at 16:07 Thursday 17th August, 2006Jon Sagara When I grow up, I'm changing my name to Joe Kickass! My Site | My Blog | My Articles
-
I am trying to move some records from table A to table B. This is what I have thus far:
declare @PartID varchar(50), @SectionNumber varchar(50), @TopWidth float, @BottomWidth float, @boltDiameter float, @pickOrder int Select * from SSVLStandardBracingDesign set @PartID = SSVLSTandardBracingDesign.PartID set @SectionNumber = SSVLStandardBracingDesign.SectionNumber set @TopWidth = SSVLStandardBracingDesign.TopWidth set @BottomWidth = SSVLStandardBracingDesign.BottomWidth set @boltDiameter = SSVLStandardBracingDesign.BracingBoltDiameter set @pickOrder = SSVLStandardBracingDesign.PickOrder insert into BracingKits (PartID, SectionNumber, topWidth, bottomWidth, boltDiameter, pickOrder, S3TL29, S3TLVL, S3TLUL, S3TLMD, S3TLHD, S3TLVH, S3TLUH,S3R, S4TL,S4A, [1200TLWD],[1800TLWD], [1800SRWD], [2400SRWD],[3600SRWD] , [4400SRWD]) VALUES (@PartID, @SectionNumber, @TopWidth, @BottomWidth, @boltDiameter, @PickOrder, 0,1,0,0,0,0,0,0,0,0, 0, 0,0,0,0,0)
I need to set my variables to values from the table. I tried using commas but that didn't work, and my multiple set statements do not work. What is the correct syntax? Thanks!Select @PartID = SSVLSTandardBracingDesign.PartID, @SectionNumber = SSVLStandardBracingDesign.SectionNumber, @TopWidth = SSVLStandardBracingDesign.TopWidth, @BottomWidth = SSVLStandardBracingDesign.BottomWidth, @boltDiameter = SSVLStandardBracingDesign.BracingBoltDiameter, @pickOrder = SSVLStandardBracingDesign.PickOrder from SSVLStandardBracingDesign