sql server 2008 sa账户无法登录,错误:233

http://hi.baidu.com/cive/blog/item/bd4e8e82a714d0b26c81198d.html 重新安装了sql server 2008,发现sa账户无法登录,错误是233。 网上找了很多帖子, 设置了“SQL   Server和Windows身份验证模式”, 也设置了sa“启用”, 也重启了N次, 都不行, 偶然看到一个办法,一试就好了。 如下:   用Windows身份验证登录,执行SQL命令: ALTER LOGIN sa WITH PASSWORD=’新密码’, 搞定,现在终于可以用sa登录SQL管理器了。 […]

Read More…

Recursive Relationships

Recursive relationships: relationships exist between entity instances of the same type. One-to-one: If we were to track which employees were married to other employees, we would expect each to be married to either zero or one other employee at any one point in time. One-to-many: It is common to track the employment “food chain” of  […]

Read More…

About Count

select count(*) FROM [AdventureWorks].[Person].[Contact] 返回表中所有的记录的个数 select COUNT(MiddleName) from [AdventureWorks].[Person].[Contact] 返回字段中,值非空的记录的个数(重复的也算进去的)  select COUNT(distinct MiddleName) from [AdventureWorks].[Person].[Contact] 返回字段中不重复且非空的记录的个数 Result: 19972 11473 70 […]

Read More…

Cursors in SQL

SQL was designed as a set-oriented processing language. Some business rules( or poor physical design) require performing actions on row-by-row basis. Consider the following example: . Increase the price of books <=$15 by 15% . Decrease the price of books > $15 by 10% Here is a set-oriented solution: update titles set price = price […]

Read More…

View – With Check Option

Creating a view using With Check Option will restrict the queries to only those rows directly visible by the view. http://www.sqlteam.com/FORUMS/topic.asp?TOPIC_ID=66019 It prevents row from dissappearing from the view implementing this option. drop table  T100 go drop view  VT100 go Create table T100 (A int) GO Create view VT100 AS (SELECT * FROM T100 WHERE […]

Read More…

Basic Rules of Normalization

Without going into a dissertation on data modeling(itself a subject of many full-length treatises), tables should follow basic rules of normalization: Avoid duplicate data, avoid repeating groups in tables, and only put data in tables where the information is directly relevant.Remove Unnormalized relation ->(Remove repeating and multivalued atrributes)-> First normal form relation ->(Remove partially dependent […]

Read More…

The logical processing of the Select statement

CREATE TABLE Loans (  loan_nbr INT NOT NULL ,  customer_nbr INT NOT NULL,  loan_date DATETIME NOT NULL,�  loan_amount DECIMAL(15, 2) NOT NULL,  loan_type CHAR(1) NOT NULL,  CONSTRAINT ck_loan_type  CHECK (loan_type IN(‘P’,’B’)), — P = Personal; –B=Business  CONSTRAINT pk_loans  PRIMARY KEY(loan_nbr)); Question: Let’s try to find the top two customers with personal loan amounts that do […]

Read More…