CREATE procedure look6
(
@radio nvarchar(50)=null
)
as
begin
declare 
@sql1 nvarchar(100),
@sql2 nvarchar(100)
set @sql1 = 'select count(*) as co from qarpt where id is not null ' 
set @sql2= 'select * from qarpt where id<>'' ' 
if(@radio<>null)
begin
set @sql1 = @sql1 + ''' and radio =''' + @radio + ''''
set @sql2 = @sql2 + ''' and radio =''' + @radio + ''''
end 
execute(@sql1)
end
GO