Showing posts with label helloi. Show all posts
Showing posts with label helloi. Show all posts

Monday, March 19, 2012

i want to ask some sqlserver question?

hello:
i want to ask some sqlserver question?Hi
Try searching sites like Google http://groups-beta.google.com/ to see if you
can match up with previous posts using key wordsfor instance an error
message number.... You may also want to search www.microsoft.com for these
as well, and take a look at http://www.microsoft.com/sql/default.mspx to see
if anything there may shed some light.
This news group is related to security, if the subject is not to do with
security you should post into newsgroup that describes your problem best.
These are a few newsgroups
http://www.microsoft.com/sql/commun...ps/default.mspx
The following is a list of other places you may wish to look
http://www.aspfaq.com/show.asp?id=2423
If you can't find the solution then you may want to post. If it is relating
to code, then you will need to post the code in question this will help if
you are having problems with SQL http://www.aspfaq.com/etiquette.asp?id=5006
John
"wanxia" <wanxiaruge@.sohu.com> wrote in message
news:cqiktv$uso$1@.news.yaako.com...
> hello:
> i want to ask some sqlserver question?
>

Friday, February 24, 2012

I need help...!

Hello!
I am using IN to determine if a given StateId values matches any value in a
query.
Previously, I used following query:
SELECT * FROM Cities WHERE StateId IN (1, 2, 3)
but now I would like to pass dynamic values as a input parameter...
SELECT * FROM Cities WHERE StateId IN(@.StateId)
StateId is an integer.
Could anyone help me with this, I can't get it working. I am new to SQL
Server.
Thank you!
JamesJames
CREATE PROCEDURE mysp
@.array nvarchar(4000)
AS
BEGIN
SET NOCOUNT ON
DECLARE @.nsql nvarchar(4000)
SET @.nsql = '
SELECT *
FROM sysobjects
WHERE name IN ( ' + @.array + ')'
PRINT @.nsql
EXEC sp_executesql @.nsql
END
GO
EXEC mysp
@.array = '''sysobjects'',''sysindexes'',''syscolu
mns'''
GO
"James T." <gimenei@.hotmail.com> wrote in message
news:O7P%23D8dOFHA.3356@.TK2MSFTNGP12.phx.gbl...
> Hello!
> I am using IN to determine if a given StateId values matches any value in
a
> query.
> Previously, I used following query:
> SELECT * FROM Cities WHERE StateId IN (1, 2, 3)
> but now I would like to pass dynamic values as a input parameter...
> SELECT * FROM Cities WHERE StateId IN(@.StateId)
> StateId is an integer.
> Could anyone help me with this, I can't get it working. I am new to SQL
> Server.
> Thank you!
> James
>|||The Curse and Blessings of Dynamic SQL
http://www.sommarskog.se/dynamic_sql.html
Arrays and Lists in SQL Server
http://www.sommarskog.se/arrays-in-sql.html
Faking arrays in T-SQL stored procedures
http://www.bizdatasolutions.com/tsql/sqlarrays.asp
How do I simulate an array inside a stored procedure?
http://www.aspfaq.com/show.asp?id=2248
AMB
"James T." wrote:

> Hello!
> I am using IN to determine if a given StateId values matches any value in
a
> query.
> Previously, I used following query:
> SELECT * FROM Cities WHERE StateId IN (1, 2, 3)
> but now I would like to pass dynamic values as a input parameter...
> SELECT * FROM Cities WHERE StateId IN(@.StateId)
> StateId is an integer.
> Could anyone help me with this, I can't get it working. I am new to SQL
> Server.
> Thank you!
> James
>
>