SQL Server Stored procedure query

Source: Internet
Author: User

This stored procedure implements a generic query on a data table

--Query Create PROCEDURE [dbo]. [Selelctmessage] @strTable varchar,  --the table to query @strcolum varchar (500),--the field to query (* denotes all fields) @strWhere varchar (500)  --The condition of the query, without adding where, direct column name = value. If the value is a string, enclose the single quotation mark asdeclare @sqlString varchar;d eclare @whereString varchar ($), if @strwhere is null or RTRIM (@ strwhere) = '    set @whereString = ', else    set @whereString = ' where ' [email protected];set @sqlString = ' SELECT ' [ Email protected]+ ' from ' [email protected][email protected];exec (@sqlString);--execute [dbo]. [Selelctmessage] ' Base._member ', ' id,acctnbr,acctname,acctpswd1 ', ' id>10 '

  

SQL Server Stored procedure query

Related Article

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.