Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Increment a Variable in a select clause

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-03-04 : 08:19:40
Bill writes "I want to increment a variable in a select statement to provice a data for a blank field.

DECLARE @MyCounter INT
SET @MyCounter = 1
SELECT
CASE
WHEN Bank_Name IS NULL THEN
'BANK-' + CAST(@MyCounter as CHAR(3))
ELSE
Bank_name
END
FROM
BANK_TABLE;

Can I increment it"

cshah1
Constraint Violating Yak Guru

347 Posts

Posted - 2005-03-04 : 08:52:37
may be this will help you

http://www.sqlteam.com/item.asp?ItemID=1417
Go to Top of Page
   

- Advertisement -