Monday, April 19, 2010

SQL Server and short tips – 3

  • Sql server Express 2005/2008 utilizes max 1 GB for CPU as well as for Ram and 4 GB for max database size.
  • statistics about SQL Server 2008 :
    • Max Data storage per database (524272 TB)
    • Max Concurrent User Connection (32767)
    • Max Databases per server (32767)
    • Max tables per database (2147483647)
    • Max columns per table (1024)
  • To hide the system database in Object Explorer: SSMS >Tools>Options>Hide system objects in Object Explorer then restart Sql Server.
  • Keep in your administrative tools, Activity Monitor can offer to you the Recent Expensive queries.
  • To see how many pages ,extents and the extent Switches in your database tables use the following command: DBCC SHOWCONTIG
  • Case sensitivity in SQL Server:



--SQL Server 2005/2008 allows you to make collation choices 
--at the server, database, column, and expression levels
--Case Sensivity determined by Collation
--Oracle, by default is case sensitive whereas 
--SQL Server installations by default are case-insensitive

DECLARE @Name1 varchar(25) ='SQL SERVER' 
       ,@Name2 varchar(25) ='sql server' 

--Here do not consider the Case Sensitivity       
IF(@Name1 COLLATE SQL_Latin1_General_Cp1_CI_AS= @Name2 COLLATE SQL_Latin1_General_Cp1_CI_AS)
    RAISERROR('They are %s',10,1,'the same')
ELSE
    RAISERROR('They are %s',10,0,'not the same')

--Here do consider the Case Sensitivity
IF(@Name1 COLLATE SQL_Latin1_General_Cp1_CS_AS= @Name2 COLLATE SQL_Latin1_General_Cp1_CS_AS)
    RAISERROR('They are %s',10,1,'the same')
ELSE
    RAISERROR('They are %s',10,0,'not the same')   
-------------------------------------------------------------------- 
DECLARE @Name3 nvarchar(25) ='أ' 
       ,@Name4 nvarchar(25) ='إ' --try to change it to ء – آ - ؤ -ئ

--Here do not consider the Accent Sensitivity       
IF(@Name3 COLLATE Arabic_CI_AI= @Name4 COLLATE Arabic_CI_AI)
    RAISERROR('They are %s',10,1,'the same')
ELSE
    RAISERROR('They are %s',10,0,'not the same')

--Here do consider the Accent Sensitivity
IF(@Name3 COLLATE Arabic_CS_AS= @Name4 COLLATE Arabic_CS_AS)
    RAISERROR('They are %s',10,1,'the same')
ELSE
    RAISERROR('They are %s',10,0,'not the same')

No comments: