View Single Post
Old 06-08-2007, 11:44 AM   #4 (permalink)
Krishnaswamy
Junior Member
 
Join Date: May 2007
Posts: 29
Default Re: Can anyone help me with this SQL query?

This is a small tutorial for you on your query questions(no pun):
This is a simpel table called Student in your database with four columns, StudentID, SFName,SLName, and DateCertified:

1 Venkat Raman 1/1/1908 12:00:00 AM
9 Jay Krishnaswamy 4/3/1941 12:00:00 AM
22 Nicole Kidman 4/5/2000 12:00:00 AM
23 John Pollack 1/1/2000 12:00:00 AM
--------------------------
This is a simple well known "SELECT" query
----------------------------
select SFname, SLName
from Student
where StudentID='9'

This gives the result
Jay Krishnaswamy------------------------------
Create a stored proc (testing)which shows all data in the table:
create proc testing as
select SFName, SLName
from Student

--------------------------------
Now the code you wantedthis creates a stored procedure newTest)
create proc newTest
@idss nchar(20)
as
select SFName, SLName
from Student
where @idss=SFName

---------------
when you run the following command:
exec newTest 'Jay'
you will get:
Jay krishnaswamy

I hope this helps.

Jay
Krishnaswamy is offline   Reply With Quote
Sponsored Links