Cross tabulation-verifying the existence of objects (3)

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.