1
111Mutay
Guest
- Konu Yazar
- #1
Bu prosedürü veritabanınıza ekleyin;
Kullanımı;
Kod:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Yapımcı : Maxis
-- =============================================
Create procedure [dbo].[kimdevar]
@num int,
@mode int
as
if @mode in (1,2)
begin
if @mode = 1 begin if exists (select * from sysobjects where id = object_id(N'found') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table found CREATE TABLE found([StrUserID] [varchar](21) NULL) end
if @mode = 2 begin if exists (select * from sysobjects where id = object_id(N'found') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table found CREATE TABLE found([strAccountID] [varchar](21) NULL) end
declare @item varbinary(4), @i int
set @item = substring(cast(@num as varbinary(4)),4,1)+substring(cast(@num as varbinary(4)),3,1)+substring(cast(@num as varbinary(4)),2,1)+substring(cast(@num as varbinary(4)),1,1)
set @i = 1
if @mode = 1 -- Charlarda Aramak İçin
begin
while @i < 401
begin
insert found select struserid from userdata where substring(stritem, @i,4) = @item
set @i = @i + 8
end end else
if @mode = 2 -- Bankalarda Aramak İçin
begin
while @i < 1601
begin
insert found select straccountid from warehouse where substring(warehousedata, @i,4) = @item
set @i = @i + 8
end end
select * from found
drop table found
end
Kullanımı;
Kod:
exec kimdevar itemin kodu,1 --Charlarda Aramak İçin Bunu Kullanın
exec kimdevar itemin kodu,2 -- bankalarda aramak İçin bunu Kullanın