sql 表修改列
create table #a
(
a int identity(1,1) primary key,
b int default(0) not null,
c nvarchar(20)
)
insert into #a(c)
select 'a' union all
select 'b' union all
select 'c' union all
select 'd' union all
select 'e'
select * from #a
alter table #a drop constraint DF__#a_____________b__1273C1CD
alter table #a add constraint DF__#a_____________b__1273C1CD default(1) for b
alter table #a add c nvarchar(10) not null constraint DF_#a_b default('aa')
--有约束的时候可以通过错误提示来查约束名
alter table 表名 drop column [列名]
alter table 表名 add [列名] [类型] NULL CONSTRAINT [DF_表名_列名] DEFAULT ((0))
select * from #a
相关文档:
---------数学函数
1.绝对值
S:select abs(-1) value
O:select abs(-1) value from dual
2.取整(大)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.取整(小)
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.取整(截取)
S:select cast ......
刚刚安装的数据库系统,按照默认安装的话,很可能在进行远程连接时报错,通常是错误:"在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接) "搜MSDN,上面有一篇机器翻译的文章,实在让人难以明白,现在 ......
Comparison of SQL and MDX Syntax
The Multidimensional Expressions (MDX) syntax is similar to the syntax of Structured Query Language (SQL). In many ways, the functionality supplied by MDX is also similar to that of SQL; with effort, you can eve ......
SQL注入攻击是黑客对数据库进行攻击的常用手段之一。随着B/S模式应用开发的发展,使用这种模式编写应用程序的程序员也越来越多。但是由于程序员的水平及经验也参差不齐,相当大一部分程序员在编写代码的时候,没有对用户输入数据的合法性进行判断,使应用程序存在安全隐患。用户可以提交一段数据库查询代码,根据程序 ......
--查看CPU利用率
-- CREATE PROCEDURE sp_GetTop10_CPU () AS
BEGIN
SET NOCOUNT ON
DECLARE @cinterval char(8)
DECLARE @interval int
SET @cinterval = '00:00:10'
CREATE TABLE #thread
(
RUN INT NOT NULL,
SPI ......