sql server new users:
This is a common issue where folks are attempting to use a varchar parameter
to simulate an array().
If you need to do handle a parameter as an array (and SQL Server does NOT
support array() datatypes, then these articles may be useful to you.
Arrays and Lists in SQL Server
http://www.sommarskog.se/arrays-in-sql.html http://www.realsqlguy.com/?p=9 http://www.aspfaq.com/2248 http://realsqlguy.com/twiki/bin/view/RealSQLGuy/ParseDelimitedStringToTable 2005-
http://omnibuzz-sql.blogspot.com/2006/06/interesting-queries-using-recursive.html --
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
[quoted text, click to view] "Daves" <dbspam@simnet.is> wrote in message
news:ONvM3I14GHA.1492@TK2MSFTNGP05.phx.gbl...
>I parse a querystring from a .net website into a stored proc;
>
> ALTER PROCEDURE Postlists_CreateList
> (
> @Groups varchar(255) = NULL
> ...
> )
> AS
>
> INSERT INTO Postlists_Recipients (PostlistID,UserID)
> SELECT @PostlistID, UserID
> FROM UsersInGroups
> WHERE UsersInGroups.GroupID IN (@Groups)
>
> Well it works fine until @Users contains comma seperated values, the idea
> was that this sp would be able to take multiple recipients this way but
> obviously Sql server complains because the datatypes aren't the same
> (GroupID is int, @Groups is varchar)... if you get my point do you know of
> any solution besides
> WHERE CAST(UsersInGroups.GroupID AS varchar(5)) IN (@Groups)
>
> which is very "clumsy"??
>