![]() |
| |||||||
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
| ||||
| I have a CURSOR (I know, shouldn’t use them, but I have no other way) and I have declared several variables like so: Code: Declare @strAttrib_1 varchar(10) Declare @strAttrib_2 varchar(10) Declare @strAttrib_3 varchar(10) Declare @i int Set @i = 0 Code: WHILE @i < 4
BEGIN
IF @strAttrib_+@i = ‘something’
BEGIN
--do something here
END
IF @strAttrib+@i = ‘somethingelse’
BEGIN
--do something else here
END
--ETC
END
__________________ Quote of the Month: Sanity: Minds are like parachutes. Just because you've lost yours doesn't mean you can borrow mine. Questions to Ponder: Why is the third hand on the watch called the second hand? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright © 2008 sbenj69 |
| Sponsored Links |
| ||||
| Hmm...not sure if that can be done. But I know in SQL Server 2005, you can use lists and arrays. Not sure if this could help you or not, but this link shows something that looks like what you're trying to do: http://www.sommarskog.se/arrays-in-sql-2005.html Code: CREATE FUNCTION iter$simple_intlist_to_tbl (@list nvarchar(MAX))
RETURNS @tbl TABLE (number int NOT NULL) AS
BEGIN
DECLARE @pos int,
@nextpos int,
@valuelen int
SELECT @pos = 0, @nextpos = 1
WHILE @nextpos > 0
BEGIN
SELECT @nextpos = charindex(',', @list, @pos + 1)
SELECT @valuelen = CASE WHEN @nextpos > 0
THEN @nextpos
ELSE len(@list) + 1
END - @pos - 1
INSERT @tbl (number)
VALUES (convert(int, substring(@list, @pos + 1, @valuelen)))
SELECT @pos = @nextpos
END
RETURN
END
__________________ jmurrayhead Did I help you out? Make me popular by clicking the icon!If you found a post helpful, please click the button in the lower right-hand corner of the post.Powered by ASP.Net |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
| Sponsored Links |
| ASP.NET Resource Index a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer. Free Web Directory Including Chats and Forums Resources, Offer automatic, instant and free directory submissions. | URLZ Web Directory URLZ Web Directory Free Web Directory - Add Your Link The Little Web Directory | Free Web Directory Pegasus free web directory is a free directory organised by categories. Web Directory & SEO Services dirroot web directory |