zoukankan      html  css  js  c++  java
  • Different between datetime and timestamp, and its setting

    According to the documentationtimestamp is a synonym for rowversion - it's automatically generated and guaranteed1 to be unique. datetime isn't - it's just a data type which handles dates and times, and can be client-specified on insert etc.

    Here is an example to use both datetime and timestamp in SQLSever . problem will happen, when you try to copy a datebase

    to a new database, then dates about the timestamp is not to copy........So what should we do about it. 

    USE [SWSK_YOSAN_161115]
    GO
    
    /****** Object:  Table [dbo].[T_TEST]    Script Date: 2017/01/27 11:55:09 ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    SET ANSI_PADDING ON
    GO
    
    CREATE TABLE [dbo].[T_TEST](
        [JIGYOCD] [char](2) NOT NULL,
        [ORDERNO] [char](8) NOT NULL,
        [LASTUPDATEYMD] [datetime] NULL CONSTRAINT [DF_T_TEST_LASTUPDATEYMD]  DEFAULT (getdate()),
        [LASTUPDATEID] [varchar](20) NULL,
        [LASTUPDPGID] [varchar](20) NULL,
        [VERSIONNO] [timestamp] NULL,
     CONSTRAINT [PK_T_TEST] PRIMARY KEY CLUSTERED 
    (
        [JIGYOCD] ASC,
        [ORDERNO] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    
    SET ANSI_PADDING OFF
    GO
    SELECT [JIGYOCD]
    ,[ORDERNO]
    ,[LASTUPDATEYMD]
    ,[LASTUPDATEID]
    ,[LASTUPDPGID]
    ,[VERSIONNO]
    FROM [dbo].[T_TEST]
    GO
    
    
    

      

     
    Love it, and you live without it
  • 相关阅读:
    数组的排序
    2017-2018学年实习心得
    2017-2018学年实习总结
    古人警句
    课程意见
    第二次冲刺第十天
    第二次冲刺第九天
    第二次冲刺第八天
    第二天冲刺第七天
    第二次冲刺第六天
  • 原文地址:https://www.cnblogs.com/tomclock/p/6353699.html
Copyright © 2011-2022 走看看