包大人博客

迎奥运、讲文明、树新风 -- Welcome To Beijin 2008

About the author

Boris Yang
A troupe of little vagrants of the world, leave your footprints in my words.
E-mail me Send mail

Recent comments

Author

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

如何在 SQL Server 中 EXECUTE 字符串时返回值

    我们经常使用 EXECTUE关键字来执行SQL字符串: [code:tsql] DECLARE @IntVariable INT DECLARE @SQLString NVARCHAR(500) -- Build and execute a string with one parameter value. SET @IntVariable = 35 SET @SQLString = N'SELECT * FROM pubs.dbo.employee WHERE job_lvl = ' +  &... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Sql Server
Posted by Admin on Monday, April 21, 2008 1:24 PM
Permalink | Comments (0) | Post RSSRSS comment feed

SQL Server 中 sp_executesql 与 EXECUTE 的差异

    在SQL Server中 EXECUTE 关键字是用来执行用户定义函数、系统过程、用户定义存储过程或扩展存储过程。同时还可以执行SQL字符串。而系统存储过程sp_executesql 执行可以多次重用或动态生成的 Transact-SQL 语句或批处理。Transact-SQL 语句或批处理可以包含嵌入参数。     下面我们就对这两个功能的相同部分“执行Transact-SQL字符串”的特点及差异做一个简单的介绍。     总的指导思想... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Sql Server
Posted by Admin on Monday, April 21, 2008 11:53 AM
Permalink | Comments (0) | Post RSSRSS comment feed

"IS NULL" and "= NULL" 在 sql server 中的区别

    当我们在 sql server 中用 DECLARE 申明一个变量时, sql server 将会把变量存储在SQLs 内存空间的变量列表区域(variable table),变量列表中包含了变量的名称和存储地址。然而如果我们在创建变量的时候并没有给变量赋值的话,sql server是没有为变量分配内存的,因此变量并没有在内存中被定义。 然后当你用 SET 关键字给变量赋值的话,sql server 将为这个值分配内存空间并将地址存放在变量列表(variable table)中。如果你再次为这个变量赋值的话新的内存地址将替换旧的地址。 ... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Sql Server
Posted by Admin on Monday, April 07, 2008 3:44 PM
Permalink | Comments (1) | Post RSSRSS comment feed

SQL SERVER 性能之 -- varchar AND nvarchar

Transact-SQL  varchar [ ( n | max ) ]       可变长度,非 Unicode 字符数据。n 的取值范围为 1 至 8,000。max (sqlserver 2005 增进)指示最大存储大小是 2^31-1 个字节。存储大小是输入数据的实际长度加 2 个字节。  1. 如果未在数据定义或变量声明语句中指定 n,则默认长度为 1。 DECLARE @myNextVariable AS varchar SET @myNextVariable... [More]

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Sql Server
Posted by Admin on Wednesday, March 19, 2008 11:29 AM
Permalink | Comments (0) | Post RSSRSS comment feed