Saturday, 15 September 2012

sql server - SQL Stored procedure Joining tables -



sql server - SQL Stored procedure Joining tables -

background: problem little specific. next spec create application , 1 of tasks involves creating stored procedure. know how create , store procedure implement one, having problem syntax of constructing one.

the spec states:

write stored procedure upgettestid. take 3 parameters: woid, sampleid , analyte need bring together tblwosampletest tbltest on testid select testid 3 values match

i having problem understanding supposed do. tables need joined because 1 table has columns woid, sampleid, testid no analyte, while other table has analyte , testid. don't know how select testid 3 values match here attempts replicate instructions:

create procedure upgettestid @woid nvarchar(60), @sampleid nvarchar(60),@analyte nvarchar(60) select testid tblwosampletest bring together tbltest on tbltest.testid=tblwosampletest.testid; @woid = tbltest.woid , @sampleid = tbltest.sampleid , @analyte = tbltest.analyte go

this did not work

create procedure upgettestid @woid nvarchar(60), @sampleid nvarchar(60),@analyte nvarchar(60) select * tblwosampletest bring together tbltest on tbltest.testid=tblwosampletest.testid; select testid @woid = tblwosampletest.woid , @sampleid = tblwosampletest.sampleid , @analyte = tbltest.analyte go

this didn't work. want know instructions want me because little confused on that.

you should against tables have required columns. otherwise first post right way.

create procedure upgettestid @woid nvarchar(60), @sampleid nvarchar(60),@analyte nvarchar(60) select testid tblwosampletest bring together tbltest on tbltest.testid=tblwosampletest.testid; @woid = tblwosampletest.woid , @sampleid = tblwosampletest.sampleid , @analyte = tbltest.analyte go

sql sql-server vba stored-procedures access-vba

No comments:

Post a Comment