Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Help Using Parameters in Query

$
0
0

I need to run a parameterized query. I was trying the below - but it tells me 0 rows inserted. Which piece is incorrect?  I am wanting to set @BankID = to the MAX possible value of BankID then select all data for the max value of BankID into the temp table.

Declare @BankID int
SELECT @BankID = MAX(BankID)
FROM dbo.CompleteBankInfo
WHERE BankID = @BankID
Select * Into #BankData
FROM dbo.CompleteBankInfo
WHERE BankID = @BankID 

SELECT * FROM #BankData


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>