i don't userstand the logic of dropping it and adding it...why not delete, reseed any identities, and insert into again?
your error is due to the fact that
a stored proc cannot have the "GO" command in it;
the "GO" command is actually for SSMS,a nd is not a valid TSQL comand.
removing the GO removes the error:
ALTER PROCEDURE [dbo].[usp_PickHistoryReportTbl]
DECLARE @cmd VARCHAR(MAX)
IF OBJECT_ID('Tbl_PickHist','U') IS NOT NULL
DROP TABLE Tbl_PickHist
CREATE TABLE dbo.Tbl_PickHist
INSERT INTO dbo.Tbl_PickHist (LastPick,ComponentItemNumber,IssuedQuantity)
SELECT * FROM S_PickHistory2
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!