instance / database / schema / object

login / user / schema (dbo)

sequence

Collation

PSM: Both Instance and DB need case insensitive

Windchill: Both Instance and DB as SQL_Latin1_General_CP1_CS_AS (Since 2012, it is Latin1_General_100_CS_AS_SC)

Cognos: DBs need case insensitive, can share same instance as Windchill

Upgrade:

About Microsoft SQL Server Collation settings in Windchill

  • Instance/Server Collation
  • Database Collation

Instance/database

  • Instance
  1. “Empty” means default Instance Name of MSSQLSERVER
  1. Can get from Service
  1. Or run query below –again NULL means default of MSSQLSERVER

SELECT SERVERPROPERTY('InstanceName')

Login/user/schema

  • Here Instance > Security > login show the Instance Login
  1. Login user can access Instance/Server, but cannot access Database/Tables
  • Database User who map to a Instance Login and define a Default Schema
  • Why SQL select * from wind.wtuser does not work (small case of wtuser)?

wtuser needs to be WTUser

  • Why SQL select * from  WTUser does not work (without wind.)?

The user’s default schema is not wind

  • What is the default schema?
    dbo

Transaction log

  • Windchill down due to database full
  1. Option #1:
  1. Reason #2:

Sequence

  • Sample  create_QueueEntry_Table.sql
  1. Create table for sequence

CREATE TABLE
entryNumber_seq (dummy
CHAR(1), value BIGINT      IDENTITY(1,1))

go

  1. Create the procedure to get/generate the
    sequence

CREATE PROCEDURE
wt_get_next_sequence_entryNumber

AS

INSERT entryNumber_seq (dummy) VALUES ('x')

RETURN SCOPE_IDENTITY()

go

Note: the
procedure changes to as below since 10.1, and then leads to CS128703

CREATE PROCEDURE
wt_get_next_sequence_entryNumber

@returnValue BIGINT OUTPUT

AS

INSERT entryNumber_seq (dummy)
VALUES ('x')

SELECT @returnValue = SCOPE_IDENTITY()

go

  1. Retrieve the sequence

DECLARE  @return_value int

EXEC     @return_value = [wind].[wt_get_next_sequence_entryNumber]

SELECT   'Return Value' = @return_value

GO

  • How to break the IDENTITY temporarily for some
    reason, e.g. configure to a BIG value to avoid ID confliction?
  1. Two methods

SET IDENTITY_INSERT
wind.entryNumber_seq ON

Insert into
wind.entryNumber_seq(dummy, value) values ('x', 99999)

SET IDENTITY_INSERT
wind.entryNumber_seq OFF

GO

OR

DBCC
CHECKIDENT('entryNumber_seq', RESEED, 100014)

GO

  • How to verify sequences, like “select * from
    user_sequences” in Oracle?

SELECT TABLE_NAME,IDENT_INCR(TABLE_NAME) AS IDENT_INCR, IDENT_CURRENT(TABLE_NAME) as IDENT_CURRENT

FROM INFORMATION_SCHEMA.TABLES

where IDENT_CURRENT(TABLE_NAME)is not null

order by TABLE_NAME;

Microsoft SQL Server的更多相关文章

  1. Microsoft SQL Server中的事务与并发详解

    本篇索引: 1.事务 2.锁定和阻塞 3.隔离级别 4.死锁 一.事务 1.1 事务的概念 事务是作为单个工作单元而执行的一系列操作,比如查询和修改数据等. 事务是数据库并发控制的基本单位,一条或者一 ...

  2. Microsoft SQL Server 2008 R2 安装卸载

    问题 问题1 标题: Microsoft SQL Server 2008 R2 安装程序 ------------------------------ 出现以下错误: Could not open k ...

  3. Sql Server系列:Microsoft SQL Server Management Studio模板资源管理器

    模板资源管理器是Microsoft SQL Server Management Studio的一个组件,可以用来SQL代码模板,使用模板提供的代码,省去每次都要输入基本代码的工作. 使用模板资源管理器 ...

  4. 未能加载包“Microsoft SQL Server Data Tools”

    直接在vs2013里的App_Data目录创建数据库,在服务器资源管理器中查看时报错: 未能加载包“Microsoft SQL Server Data Tools” 英文: The 'Microsof ...

  5. SQL SERVER错误:已超过了锁请求超时时段。 (Microsoft SQL Server,错误: 1222)

    在SSMS(Microsoft SQL Server Management Studio)里面,查看数据库对应的表的时候,会遇到"Lock Request time out period e ...

  6. Cannot set a credential for principal 'sa'. (Microsoft SQL Server,错误: 15535)

    在SQL SERVER 2008上上禁用sa登录时,遇到下面错误:"Cannot set a credential for principal 'sa'. (Microsoft SQL Se ...

  7. Microsoft SQL Server 2005 Service fails to start

    今天碰到一雷死人的事情,在Windows Server 2012 R2上安装SQL SERVER 2005标准版过程中一直遇到"The SQL Server service failed t ...

  8. Microsoft SQL Server 2008 R2官方中文版(SQL2008下载).rar

    Microsoft SQL Server 2008 R2官方中文版(SQL2008下载).rar

  9. 无法打开物理文件xxx.mdf操作系统错误 5:“5(拒绝访问。)” (Microsoft SQL Server,错误: 5120)的解决方法

    无法打开物理文件xxx.mdf操作系统错误 5:“5(拒绝访问.)” (Microsoft SQL Server,错误: 5120)的解决方法   问题描述: 在附加数据库到sql server时,附 ...

  10. 无法删除服务器 'old_server_name',因为该服务器用作复制过程中的发布服务器。 (Microsoft SQL Server,错误: 20582)

    无法删除服务器 'old_server_name',因为该服务器用作复制过程中的发布服务器. (Microsoft SQL Server,错误: 20582) 2013-01-05 15:02 478 ...

随机推荐

  1. 高效通信模型之 - 网络通信I/O模式( Windows)

      #Socket事件 >FD_CONNECT:通常由Client端socket调用socket API函数时触发 >FD_ACCEPT:通常发生在server端的事件 >网络传输服 ...

  2. Poj(2679),SPFA,邻接表(主流写法)

    题目链接:http://poj.org/problem?id=3268 题意: 有编号为1-N的牛,它们之间存在一些单向的路径.给定一头牛的编号,其他牛要去拜访它并且拜访完之后要返回自己原来的位置,求 ...

  3. SQL生成规则数

    --------------------------开始----------------------------开始值DECLARE @start INT = 1--结束值DECLARE @end I ...

  4. java中|与||,&与&&到底有什么区别呢?

    &是位运算符.&&是布尔逻辑运算符.在运行上,&两边的条件都要判断(不管前面的是ture还是false),而&&先判断前面的,若为false,则后面的不 ...

  5. 2016年11月30日 星期三 --出埃及记 Exodus 20:21

    2016年11月30日 星期三 --出埃及记 Exodus 20:21 The people remained at a distance, while Moses approached the th ...

  6. 2016年10月25日 星期二 --出埃及记 Exodus 19:9

    2016年10月25日 星期二 --出埃及记 Exodus 19:9 The LORD said to Moses, "I am going to come to you in a dens ...

  7. AutoIt实现selenium上传文件

    1,安装autoIt 2,工程中建文件夹,例如:script,将autoit 复制到该文件夹,并且编辑视频所在的文件夹的路径,编辑"au3"格式的文件 3,编辑完成后生成EXE文件 ...

  8. Java中HashMap遍历的两种方式

    Java中HashMap遍历的两种方式 转]Java中HashMap遍历的两种方式原文地址: http://www.javaweb.cc/language/java/032291.shtml 第一种: ...

  9. Zabbix监控交换机设置

    说明: Zabbix监控服务端已经配置完成,现在要使用Zabbix对交换机进行监控. 具体操作: 以下操作在被监控的交换机上进行,这里以Cisco交换机为例. 一.登录到Cisco交换机,开启snmp ...

  10. 我的android学习经历21

    怎样在代码文件中修改控件的高低 有些时候使用setHight()或者setWidth()不管用就需要使用别的方法,下面有一种方法 你使用的布局.LayoutParams lp = new 你使用的布局 ...