更改SQL 2005的登陆方式
如果你的身份验证方式为Windows集成身份验证更改为混合方式的身份验证,需要在SQL Server Configuration Management中,把TCP/IP的活动启用,也就是第一个选择的地方,选择启用。并且使用集成身份验证方式登录后,在数据库服务器上选择属性,把安全性下的WINDOWS模式改为SQL与WINDOWS模式
相关文档:
drop table father;
create table father(
id int identity(1,1) primary key,
name varchar(20) not null,
age int not null
)
drop table mother;
create table mother(
id int identity(1,1),
name varchar(20) not null,
age int not null,
husban ......
在Visual Studio 2008 中使用O/R设计器:
点添加项目,选择创建Linq to SQL项目,使用服务器资源管理器连接Northwind数据库,将Customers和Orders两个表拖到设计界面上,系统会自动创建app.config和Northwid.designer.cs,前者是配置连接数据库的连接字串;后者会生成一个继承自DataContext的类:NorthwindDataContext。
......
注释:只适合单表单列数据,
create database test
go
use test
go
create table users
(
:id int identity(1,1) primary key not null,
:name nvarchar(20)
)
go
create proc sp_Inserts
@Names nvarchar(4000)
as
declare @Name nvarchar(20),@ErrorSum int
:set @ErrorSum = 0
:begin tra ......
使用 CONVERT:
CONVERT (data_type[(length)], expression [, style])
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),\'-\',\'\'),\' \',\'\'),\':\',\'\')
20040912110608
select CONVERT(varchar(12) , getdate(), 111 ) ......
--3.3.1 使用游标法进行字符串合并处理的示例。
--处理的数据
CREATE TABLE tb(col1 varchar(10),col2 int)
INSERT tb SELECT 'a',1
UNION ALL SELECT 'a',2
UNION ALL SELECT 'b',1
UNION ALL SELECT 'b',2
UNION ALL SELECT 'b',3
--合并处理
--定义结果集表变量
DECLARE @t TABLE(col1 varchar(10),col2 varch ......