Re: Passing in a Parameter
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 01:06:06 +0200
On Thu, 28 Apr 2005 15:30:02 -0700, Kunkel wrote:
>thanks for that link! it was very helpful. but after i implemented the
>articles ideas, i came across this solution:
>
>DECLARE @Var AS VARCHAR(100)
>SET @Var = '''Dan'', ''Mike'', ''Lisa'''
>DECLARE @SQL AS varchar(1000)
>
>SET @SQL = 'SELECT *
>FROM ORDERS
>WHERE
>NAME IN (' + @Var + ')'
>
>Exec(@SQL)
Hi Kunkel,
This is dynamic SQL, and I believe that this techinique is discussed at
Erland's site as well. Please don't do this if you can avoid it. It is a
severe breach of security - you give malicious users the ability to
inject SQL.
Erland has a great article with an in-depth explanation of pros and cons
of dynamic SQL as well: http://www.sommarskog.se/dynamic_sql.html
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
.
- References:
- Passing in a Parameter
- From: Kunkel
- Re: Passing in a Parameter
- From: Hugo Kornelis
- Re: Passing in a Parameter
- From: Kunkel
- Passing in a Parameter
- Prev by Date: Re: Passing in a Parameter
- Next by Date: TOP and OFFSET
- Previous by thread: Re: Passing in a Parameter
- Next by thread: TOP and OFFSET
- Index(es):
Relevant Pages
|
|