Link to home
Create AccountLog in
Avatar of al4629740
al4629740Flag for United States of America

asked on

creating a stored procedure

I am new to making stored procedures in SQL.  I have vb6 code below that I wish to test out using a stored procedure.  Could someone assist in giving an example of what the stored procedure would look like in SQL?



 
Set conn = New ADODB.Connection

conn.Open "Provider=sqloledb;Data Source=" & ConnectionIP & ",xxxx;Network Library=DBMSSOCN;Initial Catalog= " & CAPDB & "; User ID=xx;Password=xxxxxxx"

Dim sStringtoEx As String
Dim sStringtoEx2 As String

sStringtoEx = "Update AttendanceGrid Set AttendanceGrid.[CSW/TitleXX] = tblRegistration.[CSW/TitleXX] FROM AttendanceGrid INNER JOIN tblRegistration  on AttendanceGrid.id =  tblRegistration.id"

conn.Execute sStringtoEx

sStringtoEx2 = "Update AttendanceGrid Set X = case when tblRegistration.Overage = 3 THEN  'X' else '' end FROM tblRegistration INNER JOIN AttendanceGrid  on tblRegistration.id=AttendanceGrid.id "

conn.Execute sStringtoEx2

End Sub

Open in new window

SOLUTION
Avatar of edtechdba
edtechdba
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of al4629740

ASKER

Where do I set this up in the database?
SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.