Heim >Datenbank >MySQL-Tutorial >搜索sql语句

搜索sql语句

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:57:151014Durchsuche

搜索sql语句

CREATE procedure dbo.select_a
@b varchar(50),
@c varchar(50),
@d varchar(50),
@e varchar(50)
as
declare @strsql varchar(5000) ;
set @strsql='select * from a where 1=1 ';
if @b ''
set @strsql= @strsql+' and b="'+@b +'"';
if @c ''
set @strsql= @strsql+' and c="'+@c +'"';
if @d ''
set @strsql= @strsql+' and d="'+@d +'"';
if @e ''
set @strsql= @strsql+' and e="'+@e +'"';

exec (@strsql)
GO


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn