字段a什么类型?
如果是整数 0797当然=797了
如果是字符型
你查询:
select * from tablename where 字段a='0797'
select * from tablename where 字段a='797'
看看结果
如果是整数 0797当然=797了
如果是字符型
你查询:
select * from tablename where 字段a='0797'
select * from tablename where 字段a='797'
看看结果
我需要输入一条SQL语句!
select * from table where a = @a or a = right(@a,3)
Insert @test values('799')Declare @var intSet @var = 799
Select * from @test where f_1 = @varSet @var = 0799
Select * from @test where f_1 = @var-- 兩方法都可以
select @a='05201314'
if left(@a,1)='c' set @a=substring(@a,2,len(@a)-1)
select @a='%'+@a
print @a
select * from tabName where a like @a
select @a='05201314'
if left(@a,1)='0' set @a=substring(@a,2,len(@a)-1)
select @a='%'+@a
print @a
select * from tabName where a like @a