摘要:
首先看以下SQL逻辑语句块:
DECLARE @fieldname varchar(50)
DECLARE @fieldvalue nvarchar(100)
SET @fieldname='chassisno' --这里可传入chassisno,plateno,owner,contacttelno其中之一或不传
SET @fieldvalue='Zuowenjun'
IF @fieldname = 'chassisno'
BEGIN
SELECT * FROM TABLENAME WHERE chassisno=@fieldvalue
END
ELSE IF @fieldname = 'plateno'
BEGIN
SELECT * FROM TABLENAME WHERE plateno=@fieldvalue
END
ELSE IF @fieldname = 'owner'
BEGIN
SELECT * FROM TABLENAME WHERE [owner]=@fieldvalue
END
ELSE I 阅读全文