34,587
社区成员
发帖
与我相关
我的任务
分享
CREATE PROC sp_test(@ID INT)
AS
BEGIN
SET NOCOUNT ON
SELECT * FROM A WHERE ID=@ID OR (LEN(ID)=4 AND LEFT(LTRIM(ID),2)=@ID) OR (LEN(ID)=6 AND LEFT(LTRIM(ID),2)=@ID)
SET NOCOUNT OFF
END
create proc p
@s int
as
begin
select * from A where len(id)=len(@s)
union all
select * from A where len(id)=len(@s)+2 and left(id,2)=@s
end
create proc sp_test @s int
as
begin
select * from tb where len(id)=len(@s)+2 and left(id,len(@s))=@s
end
create proc proc_test
@id varchar(20)
as
select * from [Table] where len(id) between len(@id) and len(@id)+3 and left(id,2)=@id
create proc f
(
@id varchar(20)
)
as
select * from [Table] where len(id)>len(@id) and left(id,2)=@id
create proc proc_getdata @id varchar(30)
as
begin
select * from tb
where len(id) = len(@id)+2 and left(id,len(@id))=@id
end
create proc proc_test
@id varchar(20)
as
select * from [Table] where len(id)>len(@id) and left(id,2)=@id
create proc p
@s int
as
begin
select * from A where len(id)=2
union all
select * from A where len(id)=4 and left(id,2)=@s
end