>IF OBJECT_ID('dbo._CraigTest') IS NOT NULL > DROP PROC dbo._CraigTest >GO > >create procedure [dbo].[_CraigTest] >@TableNoField smallint, >@DbvField varchar(40), >@PK int output, >@B1 binary(5) output,-- RecLen & Hlocks >@A6 int output, -- AutoInc >@B10 binary(2) output,-- Checksum >@K12 smallint output, -- Table No >@K14 int output, -- Modified DDT >@B18 binary(4) output, -- Reserved >@K22 varchar(13) output, -- Patnum/dbvalue >@K35 varchar(33) output, -- Name >@B68 binary(61) output, -- DSO >@T128 image output -- DSO > >as >Select top 1 > @PK = pk, > @B1 = B1, > @A6 = A6, > @B10 = B10, > @K12 = K12, > @K14 = K14, > @B18 = B18, > @K22 = K22, > @K35 = K35, > @B68 = B68, > @T128 = T128 > from dbo.tables_dat > with (index(ix_Tables_dat1), nolock) > where K12 = @TableNoField > and K22 = @DbvField >