Another sproc question

Another sproc question

Post by Brad M » Thu, 15 Aug 2002 03:52:09



Hi.  I was wondering if I could use variables in a stored procedure that
would be passed to SQL by VB.  For instance, I have a variable in my app
called varUID which stores the UserID of the current session.  So could I
include that variable in my sproc code?  I would include an example, but
this is an idea right now and I haven't done anything with it yet.  I'm just
wondering IF in fact it can be done.

Thanks,
Brad

 
 
 

Another sproc question

Post by Narayana Vyas Kondredd » Thu, 15 Aug 2002 04:02:32


Yes you can. You will have to pass that value as an input parameter to the
stored procedure.
--
HTH,
Vyas, MVP (SQL Server)

http://vyaskn.tripod.com/


Hi.  I was wondering if I could use variables in a stored procedure that
would be passed to SQL by VB.  For instance, I have a variable in my app
called varUID which stores the UserID of the current session.  So could I
include that variable in my sproc code?  I would include an example, but
this is an idea right now and I haven't done anything with it yet.  I'm just
wondering IF in fact it can be done.

Thanks,
Brad

 
 
 

Another sproc question

Post by oj » Thu, 15 Aug 2002 03:59:23


You would be able to pass anything to a stored procedure as input
parameters. But, what you can do with it is another matter.

--
-oj
Rac v2.1 Public Beta is RELEASED.
http://www.rac4sql.net


Quote:> Hi.  I was wondering if I could use variables in a stored procedure that
> would be passed to SQL by VB.  For instance, I have a variable in my app
> called varUID which stores the UserID of the current session.  So could I
> include that variable in my sproc code?  I would include an example, but
> this is an idea right now and I haven't done anything with it yet.  I'm
just
> wondering IF in fact it can be done.

> Thanks,
> Brad

 
 
 

Another sproc question

Post by Michael MacGrego » Thu, 15 Aug 2002 03:55:08


If you have BOL (Books OnLine) you should read up on the section about
Stored Procedures.


AS
SELECT * FROM MyTable

RETURN

Michael MacGregor
Database Architect
SalesDriver

 
 
 

Another sproc question

Post by Dart Dat » Thu, 15 Aug 2002 04:55:16


this is what I do with a variable from VB.. ive combined all of the
functions INSERT UPDATE and DELETE depending on the variable TASK
I hope this can provide you with enough information , so that you can modify
your script to work as needed

        Public Function ADDNEWITEM(ByVal TASK As String, ByVal ITEMID As
Long, ByVal partID As Long, ByVal partQTY As Integer, ByVal partATTRIBs As
String) As String
         Dim connectstring As String
         connectstring = "Provider=SQLOLEDB.1;Password=;Persist Security
Info=True;User ID=;Initial Catalog=;Data Source="
         Dim ret As Integer
         Dim SQL As String
         SQL = "execute spCartDETAIL '" & TASK & "'," & ITEMID & "," &
basketID & ", " & partID & ", " & partQTY & ", '" & partATTRIBs & "','" &
SITE & "'"
         Dim CONN As New ADODB.Connection
         CONN.Open connectstring
         CONN.Execute (SQL)
         ADDNEWITEM = "<!--" & SQL & "-->"
    end function








As




begin


insert into CartDETAIL
(basketID,partID,partNAME,partIMAGE,partQTY,partPRICE,partATTRIBs,partSHIPWT
r

end


begin


end


begin


end



return


Quote:> Hi.  I was wondering if I could use variables in a stored procedure that
> would be passed to SQL by VB.  For instance, I have a variable in my app
> called varUID which stores the UserID of the current session.  So could I
> include that variable in my sproc code?  I would include an example, but
> this is an idea right now and I haven't done anything with it yet.  I'm
just
> wondering IF in fact it can be done.

> Thanks,
> Brad

 
 
 

1. Newbie sproc question - passing params

    Hi all,

    I can't figure out why this SP won't work.  Can anyone shed some light
on this?   The second and third lines of the 'where' statement function
properly, but when I add the first line, it keeps saying "0 rows affected".
I assume that I absolutely need that first line in there, as I'm going to
use this to drop a table eventually.  I exec this statement with the
following:

EXEC sp_test1 'test1'
--because test1 is the name of the table  I'm looking for.  Thanks!

CREATE PROCEDURE sp_test1

AS
select name, id
from sysobjects
where


and OBJECTPROPERTY(id, N'IsUserTable') = 1

2. 17418-CT-Hartford-ORACLE-DB2-Bachman-Data Modeler

3. SPROC question

4. Multi User Database Issues

5. sproc question

6. Restore backup dump

7. :: how do I insert records in a .mdb linked server ::

8. Sproc Question

9. Exec SProc from SProc (output parameter question)

10. Using sproc resultset in another sproc