Selamlar
Kod:
CREATE TABLE [dbo].[GOAL] (
[Sira] [int] IDENTITY (1, 1) NOT NULL ,
[Players] [int] NULL ,
[Date] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[ExtDate] [datetime] NULL
)
Yukarıdaki kod ile tablomuzu oluşturalım.
Kod:
-- Günlük Max Ziyaret
declare @tarih datetime, @tarih2 varchar(100)
set @tarih = getdate()
select @tarih2 = convert (varchar(30),@tarih,104)
-- Önce o tarihi ekleyelim..
if (select count(date) from goal where date = @tarih2) = 0
begin
insert into goal (players, date) values (0, @tarih2)
end
-- Şimdi Kullaniciya bakalim
if (select players from goal where date = @tarih2) < (select count(straccountid) from currentuser)
begin
update goal set players = (select count(straccountid) from currentuser), extdate = getdate() where date = @tarih2
end -- Değiştiren Top ossun, Outur : Mist
Kod:
Select * from goal
Yukarıdaki komut ile , hergün için 1 sefer log açar ve o günden sonra, max ziyaretçinizin üstüne çıkarsanız o satırı update eder.
Kod:
CREATE TABLE [dbo].[GOAL] (
[Sira] [int] IDENTITY (1, 1) NOT NULL ,
[Players] [int] NULL ,
[Date] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[ExtDate] [datetime] NULL
)
Yukarıdaki kod ile tablomuzu oluşturalım.
Kod:
-- Günlük Max Ziyaret
declare @tarih datetime, @tarih2 varchar(100)
set @tarih = getdate()
select @tarih2 = convert (varchar(30),@tarih,104)
-- Önce o tarihi ekleyelim..
if (select count(date) from goal where date = @tarih2) = 0
begin
insert into goal (players, date) values (0, @tarih2)
end
-- Şimdi Kullaniciya bakalim
if (select players from goal where date = @tarih2) < (select count(straccountid) from currentuser)
begin
update goal set players = (select count(straccountid) from currentuser), extdate = getdate() where date = @tarih2
end -- Değiştiren Top ossun, Outur : Mist
Kod:
Select * from goal
Yukarıdaki komut ile , hergün için 1 sefer log açar ve o günden sonra, max ziyaretçinizin üstüne çıkarsanız o satırı update eder.