[webshow] [tinyint] 
而录的是‘1’
修改如下:
Select @InsertInitValue = 
'INSERT INTO tina'+@code+'_config (keys,webshow,type,value,value2,notes) VALUES (''INVALID'',1,''init'',''一些值'',''0_'',''一些说明'')'+
'INSERT INTO tina'+@code+'_config (keys,webshow,type,notes) VALUES (''MANUAL'',1,''init'',''一些说明'')'

解决方案 »

  1.   

    我的电脑上测试没错:--你原来的存储过程
    CREATE PROCEDURE [tina_CreateTableOrTrigger]
           @code varchar (20)
    ASDeclare @CreateTableOrTrigger nvarchar (3000),
            @InsertInitValue nvarchar (3000)Select @CreateTableOrTrigger = 
    'CREATE TABLE [dbo].[tina'+@code+'_config] ('+
    '[id] [int] IDENTITY (1, 1) NOT NULL ,'+
    '[keys] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,'+
    '[webshow] [tinyint] NULL CONSTRAINT [DF_tina'+@code+'_config_show] DEFAULT (1),'+
    '[type] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,'+
    '[value] [varchar] (180) COLLATE Chinese_PRC_CI_AS NULL ,'+
            '[value2] [varchar] (180) COLLATE Chinese_PRC_CI_AS NULL ,'+
    '[notes] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,'+
    '[CreateTime] [datetime] NULL CONSTRAINT [DF_tina'+@code+'_config_CreateTime] DEFAULT (getdate()),'+
    'CONSTRAINT [PK_tina'+@code+'_config] PRIMARY KEY  CLUSTERED'+
    '([id])ON [PRIMARY])'+
            'ON [PRIMARY]' Select @InsertInitValue = 
    'INSERT INTO tina'+@code+'_config (keys,webshow,type,value,value2,notes) VALUES (''INVALID'',''1'',''init'',''一些值'',''0_'',''一些说明'')'+
    'INSERT INTO tina'+@code+'_config (keys,webshow,type,notes) VALUES (''MANUAL'',''1'',''init'',''一些说明'')'Exec sp_executesql @CreateTableOrTrigger
    Exec sp_executesql @InsertInitValueGo--测试你的存储过程
    exec tina_CreateTableOrTrigger 'aa'
    go--删除测试过程生成的表和存储过程
    drop table tinaaa_config
    drop procedure tina_CreateTableOrTrigger
      

  2.   

    测试的结果并没有出现你所说的错误,结果是:(所影响的行数为 1 行)
    id   keys      webshow type    value   notes   CreateTime 
    ---- --------- ------- ------- ------- ------- -------------- 
    1    INVALID   1       init    一些值   一些说明   2003-07-01 21:51:05.030
    2    MANUAL    1       init    NULL     一些说明   2003-07-01 21:51:05.030
    (所影响的行数为 1 行)说说你的系统环境和版本.而且显示表的内容也正常:
      

  3.   

    我建表的同时也建了该表的触发器:Set @CreateTableOrTrigger = 
    'CREATE TRIGGER [tina'+@code+'_config_on_update] ON [tina'+@code+'_config]'+Char(13)+
    'FOR UPDATE'+Char(13)+
    'AS'+Char(13)+Char(13)+Char(13)+
    'Declare @id int'+Char(13)+
    'Select @id = [id]'+Char(13)+
    'from deleted'+Char(13)+Char(13)+Char(13)+
    'Insert into tina'+@code+'_config_log (keys,type,webshow,value,value2,notes,createtime)'+Char(13)+
    'Select keys,type,webshow,value,value2,notes,createtime'+Char(13)+
    'from tina'+@code+'_config'+Char(13)+
    'where [id] = @id'Exec sp_executesql @CreateTableOrTrigger我把触发器删除了,再更新那两条记录就不会出错了
    但是还是想不通为什么 后面添加的记录却可以修改
    也不知道这个触发器哪里有错?
      

  4.   

    表 tina'+@code+'_config_log  和 表tina'+@code+'_config 的 结构是一样的