Thursday, 16 October 2014

Select the top 1 into a variable


Declare @Column int

SELECT TOP 1 @Column = Column1 
FROM tbl_Test 
WHERE Column2 = 'test' 

In above query Column1, Column2 are two columns of table 'tbl_Test'. 

No comments:

Post a Comment