Cross tabulation-verifying the existence of objects (3) cross tabulation-verifying the existence of source objects through the sysobjects table. all three provided columns are checked to see whether the provided source object exists in the syscolumns table. -- checkifsourceexistsifnotexists (select * fromsysobjectswherename @ c
Cross tabulation-verifying the existence of objects (3) cross tabulation-verifying the existence of source objects through the sysobjects table. all three provided columns are checked to see whether the provided source object exists in the syscolumns table. -- check if source exists if not exists (select * from sysobjects where name = @ c
Cross tabulation-verifying the existence of objects (3)Cross tabulation
-- Test the sysobjects table to verify the existence of the source object. all three provided columns are checked to see whether the provided source object exists in the syscolumns table. -- check if source exists if not exists (select * from sysobjects where name = @ chrsource and type in ('v'', 'u '')) begin raiserror 51001 ''source does not exist. ''return-1 end -- check for column existence if not exists (select SC. name from syscolumns SC join sysobjects so on SC. id = so. id where so. name = @ chrsource and SC. name = @ chrhead) begin raiserror 51002 ''invalid @ chrcolhead name'' return-1 end if not exists (select SC. name from syscolumns SC join sysobjects so on SC. id = so. id where so. name = @ chrsource and SC. name = @ chrrowhead) begin raiserror 51002 ''invalid @ chrrowhead name'' return-1 end if not exists (select SC. name from syscolumns SC join sysobjects so on SC. id = so. id where so. name = @ chrsource and SC. name = @ chrvalue) begin raiserror 51002 ''invalid @ chrvalue name'' return-1 end -- verify type is valid 1 (sum) 2 (avg) etc... if @ inytype <1 or @ inytype> 5 -- if @ inytype not between 1 and 5 begin raiserror 51000 ''invalid crosstab type'' return-1 end