🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.databases.mssql-l
Article #2099

SQL statements with input parameters (Dynamic SQL)

#2099
From: Naneera Vidhayasirinun
Date: Mon, 10 Apr 1995 00:00
24 lines
1321 bytes
I am creating a stored procedure on a MS SQL server.  I wonder if it is 
possible to execute an SQL statement using parameters that can be changed for 
each execution?

For example, can I do something like this?

SELECT COUNT(DISTINCT RECEIPT_ID) >= @INPACK FROM TOPACK WHERE "@PK&S"

where
@INPACK = '840700'      // or some numbers
@PK&S    = 'SORT_OF_GIFT = 'E''

Is there any book that describes procedures similar to this?

I will appreciate very much any input anyone can give on this issue.

********************************************************************** 
Naneera Vidhayasirinun

U of I Foundation                       
303 Harker Hall                         voice:  (217) 244-7737
1305 West Green                      fax:      (217) 244-0134
Urbana, IL 61801                      e-mail: naneera@uiuc.edu
**********************************************************************
Technical Details
Message-ID: <naneera.1.0009F679@uiuc.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6611,a6dea062b0a39bea,start
X-Google-Attributes: gidf6611,public
From: naneera@uiuc.edu (Naneera Vidhayasirinun)
Subject: SQL statements with input parameters (Dynamic SQL)
Date: 1995/04/10
Message-ID: <naneera.1.0009F679@uiuc.edu>
X-Deja-AN: 100230925
organization: UIF
keywords: SQL, Dynamic SQL
newsgroups: bit.databases.mssql-l