Monday, 3 July 2017

Temp Table Variable in sql

DECLARE @tmpOldTable TABLE
(
ID BIGINT, DueDate DATETIME, ContactID BIGINT,
Email NVARCHAR(100), Mobile NVARCHAR(50), Phone NVARCHAR(50),
Subject NVARCHAR(100), Description NVARCHAR(MAX), ProductID BIGINT,
StatusID INT, PriorityID INT, ChannelID INT,
ClassificationID INT, Owner NVARCHAR(50)
)

INSERT INTO @tmpOldTable
(ID,DueDate,ContactID,Email,Mobile,Phone,[Subject],[Description],ProductID,
StatusID,PriorityID,ChannelID,ClassificationID,Owner)
SELECT TOP 1 ID,DueDate,ContactID,Email,Mobile,Phone,[Subject],[Description],ProductID,
StatusID,PriorityID,ChannelID,ClassificationID,Owner
FROM TableName WHERE ID=@ID

Select * FROM @tmpOldTable

No comments:

Post a Comment

React Hooks - custom Hook

  v CustomHook Ø React allows us to create our own hook which is known as custom hook. Example – 1 localStorage Demo Step-1 Create ...