16.02.2005, 07:58
|
#2
|
|
Архивный участник
Join Date: Feb 2005
Posts: 46
|
In game user online status in u bbs, for job it - create sheluded task in sql agent .. start this script for 1 min...
Nice it?
Quote:
declare @table_name nvarchar(64)
declare @sql nvarchar(1024)
set @table_name = 'Insert_U_TableA_name(Board_6)'
set @sql = 'DROP TABLE [dbo].['+@table_name+']'
exec (@sqlj
-- begin tran
set @sql = ' CREATE TABLE [dbo].[' + @table_name + '] ( '
+' [root_bid] [int] IDENTITY (1, 1) NOT NULL , '
+' [thread_order] [smallint] NOT NULL , '
+' [bid] [int] NOT NULL , '
+' [step] [smallint] NULL , '
+' [parent_bid] [int] NOT NULL , '
+' [char_id] [int] NULL , '
+' [char_name] [nvarchar] (50) , '
+' [account_id] [int] NULL , '
+' [account_name] [nvarchar] (50) , '
+' [world_id] [smallint] NULL , '
+' [title] [nvarchar] (128) , '
+' [content] [nvarchar] (3000) , '
+' [post_date] [datetime] NULL , '
+' [modify_date] [datetime] NULL , '
+' [read_count] [int] NULL , '
+' [status] [int] NULL, '
+' [ip] [nvarchar] (20), '
+' [comment_cnt] [smallint] NULL , '
+' [keyword] [nvarchar] (20) '
+') ON [PRIMARY] '
exec (@sql)
set @sql = ' ALTER TABLE [dbo].[' + @table_name + '] WITH NOCHECK ADD '
+' CONSTRAINT [DF_' + @table_name + '_thread_order] DEFAULT (0) FOR [thread_order], '
+' CONSTRAINT [DF_' + @table_name + '_parent_bid] DEFAULT (0) FOR [parent_bid],'
+' CONSTRAINT [DF_' + @table_name + '_step] DEFAULT (0) FOR [step],'
+' CONSTRAINT [DF_' + @table_name + '_world_id] DEFAULT (1) FOR [world_id],'
+' CONSTRAINT [DF_' + @table_name + '_post_date] DEFAULT (getdate()) FOR [post_date],'
+' CONSTRAINT [DF_' + @table_name + '_read_count] DEFAULT (0) FOR [read_count], '
+' CONSTRAINT [DF_' + @table_name + '_status] DEFAULT (0) FOR [status], '
+' CONSTRAINT [DF_' + @table_name + '_comment_cnt] DEFAULT (0) FOR [comment_cnt] '
exec (@sql)
set @sql = 'INSERT INTO [dbo].['+@table_name+'] (parent_bid,bid,world_id, title) select 1,R1.char_id,1,R1.char_name from ( select char_name,char_id from lin2world.dbo.user_data where login>logout) as R1'
exec (@sql)
|
Sorry for my eng...
US&Eng - дерьмо.
Russian&China forever %-)
|
|
|