连接ms sql数据库写法
windows 集成验证:
<connectionStrings>
<add name="ConnectionStr" connectionString="Data Source=CAIPENG-PC;database=Test;Integrated Security=SSPI" providerName="System.Data.SqlClient"/>
</connectionStrings>
或者
<connectionStrings>
<add name="ConnectionStr" connectionString="Data Source=CAIPENG-PC;Initial Catalog=Test;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
混合验证:
<connectionStrings>
<add name="ConnectionStr" connectionString="Data Source=CAIPENG-PC;Initial Catalog=Test;uid=sa;pwd=caipeng" providerName="System.Data.SqlClient"/>
</connectionStrings>
取ConnectionStr:
string conn=System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionStr"].ConnectionString;
相关文档:
SELECT ID,TITLE,
(SELECT TIMES from CLS_COURSE WHERE CLS_COURSE.ID=CLS_CLASS.COURSEID) AS TIMES,
(SELECT CASE WHEN EXISTS(SELECT * from CLS_ATDC WHERE CLS_ATDC.CLSID=CLS_CLASS.ID ) THEN (SELECT TOP 1 COURSETIME from CLS_ATDC WHERE CLS_ATDC.CLSID=CLS_CLASS.ID ORDER BY COURSETIME DESC) ELSE 0 ......
ORACLE常用SQL优化hint语句
http://oracle.chinaitlab.com/induction/802186.html
在SQL语句优化过程中,我们经常会用到hint,现总结一下在SQL优化过程中常见Oracle HINT的用法:
1. /*+ALL_ROWS*/
表明对语句块选择基于开销的优化方法,并获得最佳吞吐量,使资源消耗最小化.
例如:
SELECT /*+ALL+_ROW ......
1.查找重复数据表的id以及重复数据的条数
select max(id) as nid,count(id) as 重复条数 from tableName
group by linkname Having Count(*) > 1
2.查找重复数据表的主键
select max(id) as nid from tableName
group by linkname Having Count(id) > 1
3.删除重复的数据
delete from table ......
(1) Connect to the Analysis server, select the database which we want it to be automatically processed. Right click on this database, choose ‘Process’:
(2) In the opening ‘Process database’ form, click the ‘Script Action ......
刚刚安装的数据库系统,按照默认安装的话,很可能在进行远程连接时报错,通常是错误:"在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接) "搜MSDN,上面有一片机器翻译的文章,是在让人难以明白,现在 ......