Tuesday, May 12, 2015

Get SQL Loginame when you know the password




Did you ever found yourself in a situation where a user knows their sql login password but not username? Well, I did.  I want to share this SQL statement that helps you to retrieve the name of sql login if you know the password.


--will return any name with the same password as in the Check text.
SELECT name FROM sys.sql_logins
WHERE PWDCOMPARE('', password_hash) = 1

Friday, March 21, 2014

Updatable columnstore clustered indexes, is it new feature for SQL 2014 ?

The new release of SQL server 2014 boosts on improvement of columstore index. As we all know, SQL Server 2012 introduced columnstore indexes. I haven't seen it widely used in data warehouse implementation due to the fact that you can not update. If you want to reload the data you have to drop and re-create the index. This might be possible if you are working with rows less than 1 billion. But if your table is more than 1 billion it is very difficult to use. So, the new release not only made the column store index updatable but also can be clustered index. It is all good news but is this a new feature ? I would say for normal version of SQL server it can be seen as new. But, Microsoft released this feature with SQL Server 2012 Parallel data warehouse. What they did is they moved the technology to new version of SQL server. To claim this is a new technology in my opinion is wrong and misleading. The technology was there in their special version of SQL server 2012 (for Parallel data warehouse).

Wednesday, March 19, 2014

Microsoft's SQL Server 2014 release code: First look

It come so fast after the release of 2012 but the new SQL server has arrived. Read more SQL server 2012 realease

Friday, January 17, 2014

SQL Server 2014 release date?

The exact date of release is still not set but insider from Microsoft thinks it will be released in the first half of 2014. or 3rd Quarter of 2014. Played with CP2 and looks pretty good. Waiting to play with when it is released. As usual, I will wait till SP1 is released before moving any production probably early next year

Wednesday, August 28, 2013

SQL 2014 new feature (Updatable columnstore)

One of the new features introduced on SQL server 2012 was a memory optimized columnstore index. This feature not only reduces the amount of storage but also the speed of the query. During my test, I found that the speed of a query performance before and after columnstore index was in magnitude of 15 times faster. Wow, that was very impressive. As being new feature it have its own drawbacks. You are not able to update the data, hum. The workaround was very cumbersome and not suitable for some of data warehouse solutions. If you want to update data you need to drop the columnstore index update the data and recreate it.

If you have already upgraded to 2012 to make use of the columnstore index then you may have to upgrade to the new SQL server 2014. SQL 2014 doesn’t require the workaround of updating data. The new release enhanced the columnstore to be a pure columnar store. Bang on!!

Data warehouse is much happier place to be with SQL 2014. Not only you will be able to save space but also increase query performance.

Thursday, August 22, 2013

When is SQL server installed

I have been asked may times how to find when a SQL server is installed. Mostly I told them to find the installation log. But, what I didn't realized is that you can find out by querying sys.syslogin database.To my surprise, quiet an easy statement. You can use
SELECT  createdate as Sql_Server_Install_Date, *
FROM    sys.syslogins
where   sid = 0x010100000000000512000000 
or
SELECT  createdate as Sql_Server_Install_Date
FROM    sys.syslogins
where  loginname = 'NT AUTHORITY\SYSTEM'
One of the above will do  as long as default language is English

Flushing the cache for one database

DECLARE @DBID int
 SET @DBID = ( SELECT dbid FROM master.dbo.sysdatabases WHERE name = 'db')
--Flush procedure on the db
DBCC FLUSHPROCINDB (@intDBID)

Friday, May 17, 2013

Execution plan puzzle


I recently come accross a query that used to run fine on production server but suddenly
Execution plans can be affected by different statistics, parallelism due to number of processors, the amount of available RAM in the server, different service packs, different server configuration settings, and the current load on the server. I imagine one or more of these are causing what you are seeing.

Friday, May 11, 2012

SQL server system table corruption

Recently I came across a sage database that has been corrupted. When running DBCC CHECKDB command I was getting the following errors:

There are 226 rows in 1 pages for object "sys.sysprivs".
DBCC results for 'sys.sysschobjs'.
Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 34, index ID 2, partition ID 562949955649536, alloc unit ID 562949955649536 (type In-row data). Keys out of order on page (1:47), slots 66 and 67.
Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 34, index ID 2, partition ID 562949955649536, alloc unit ID 562949955649536 (type In-row data). Keys out of order on page (1:47), slots 72 and 73.
Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 34, index ID 2, partition ID 562949955649536, alloc unit ID 562949955649536 (type In-row data). Keys out of order on page (1:47), slots 93 and 94.
There are 4147 rows in 93 pages for object "sys.sysschobjs".
CHECKDB found 0 allocation errors and 3 consistency errors in table 'sys.sysschobjs' (object ID 34).

Normally the re-indexing should have fixed this type of issue when the base table is user table but it didn't. To fix the issue I have to perform the following commands



use DatabaseName
 go
ALTER DATABASE DatabaseName  SET SINGLE_USER
go
DBCC CHECKDB('DatabaseName', REPAIR_REBUILD)
 go
The outcome from the above command was

Repair: The Nonclustered index successfully rebuilt for the object "sys.sysschobjs, nc1" in database "FCE_Sage".
Msg 8945, Level 16, State 1, Line 1
Table error: Object ID 34, index ID 2 will be rebuilt.
        The error has been repaired.
Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 34, index ID 2, partition ID 562949955649536, alloc unit ID 562949955649536 (type In-row data). Keys out of order on page (1:47), slots 66 and 67.
        The error has been repaired.
Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 34, index ID 2, partition ID 562949955649536, alloc unit ID 562949955649536 (type In-row data). Keys out of order on page (1:47), slots 72 and 73.
        The error has been repaired.
Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 34, index ID 2, partition ID 562949955649536, alloc unit ID 562949955649536 (type In-row data). Keys out of order on page (1:47), slots 93 and 94.
        The error has been repaired..

Tuesday, April 24, 2012

Latest version of SQL server

To get an idea of what the latest version of SQL server will be, you can ask a SQL guru @Ask SQL Guru

Cannot shrink tempdb


How to shrink tempDB

SELECT * FROM sys.dm_exec_requests WHERE database_id = 2

select * from sys.dm_tran_locks
where resource_database_id= 2

select * from sys.dm_db_session_space_usage
where user_objects_alloc_page_count<> 0

SELECT * FROM sys.all_objects
where is_ms_shipped = 0

DBCC FREEPROCCACHE
BCC SHRINKFILE ('tempdev', 1024)



Purge all data in database

Recently I have been tasked to purge all data in the database. When trying to delete data from tables which have foreign key relationship the standard purge routine will fail or you have to spend time to get which table to purge first. Also there is an issue of identity as when you delete data from the table the identity will not go back to starting point. After few research, I have got the best method which is shown below. 1. Disable all constraints in the database using the following command exec sp_msforeachtable "ALTER TABLE ? nocheck contraint all" 2. Delete all data in the database exec sp_MSForEachTable "DELETE FROM ?" 3. Enable all constraints exec sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all" 4. Reset tables with identity. Note when you run the following it will give you error if the table doesn't have identity column. Ignore the errors. exec sp_MSforeachtable "DBCC CHECKIDENT ( '?', RESEED, 0)"

Friday, January 27, 2012

SQL server 2012 lauch date

New version of SQL server 2012 launch date is set for 7th of March. The offering will be in three main edition. Details of edition feature comparison can be found at Feature comparison
  • Enterprise Edition (EE) will be licensed based on compute capacity measured in cores
  • Business Intelligence (BI) Edition will be available in the Server + CAL model, based on users or devices
  • Standard Edition (SE) offers both licensing models to address basic database workloads

    There will be Web Developer and Express versions but this is not detailed enough and we just have to wait and see.

    SQL Server 2012 will continue to offer two licensing options one is based on
    one based on computing power and the other is based on based on users or devices. The way the power is measured is not processor rather core based.
  • Friday, October 14, 2011

    Partitioning an existing table and archiving part I

    Recently, I have been tasked to come up with a solution to partition a table with clustered index. Previously, I have setup partition from scratch and was loading data to the new partition from non-partitioned table. When a table that you want partition have got a clustered index the job is much easier. I have followed the following steps to achieve my goal.

    You don't need to do step 1 to 4 when the database and table/data exists. This is for demo and completeness purposes. You can directly jump to step 5
    1.Create database

    CREATE DATABASE MyPartitionDB

    2. Create table
    CREATE TABLE mytableToPartition(MyId INT IDENTITY(1,1), LastUpdated datetime)

    3. Populate sample data
    declare @timedate datetime
    set @timedate = DATEADD(YEAR, -10, GETDATE())
    while @timedate < '20121010'
    begin
    INSERT INTO mytableToPartition (LastUpdated)
    values (@timedate)
    set @timedate = DATEADD(MINUTE, 20, @timedate)
    end


    4. Create Index on existing table


    CREATE clustered index CL_MyId on mytableToPartition(MyId)


    The idea is to move all the data that is created before 2009 as archive and the others as one year partition. Effectively
    < 1 Jan 2009
    Jan 1 2009 to 31 Dec 2009
    Jan 1 2010 to 31 Dec 2010
    >= Jan 1 2011
    Which means we will have four partitions.

    5. Create Filegroups and add file to each Filegroup. For demo purpose I added only one file per Filegroup. As you can see below I created four Filegroups. One Filegroup for each partition. But, you don't have to create four Filegroups. You can use only one Filegroup for all partition but it is better for maintenance purposes and if you want move one Filegroup to different spindle it make it much easier.

    ALTER DATABASE MyPartitionDB ADD FILEGROUP FG1;
    ALTER DATABASE MyPartitionDB ADD FILEGROUP FG2;
    ALTER DATABASE MyPartitionDB ADD FILEGROUP FG3;
    ALTER DATABASE MyPartitionDB ADD FILEGROUP FG4;
    -- now add file to each filegroup
    ALTER DATABASE MyPartitionDBADD FILE(name='FG1',FILENAME='C:\temp\fg1.ndf') TO FILEGROUP FG1
    ALTER DATABASE MyPartitionDB ADD FILE(name='FG2',FILENAME='C:\temp\fg2.ndf') TO FILEGROUP FG2
    ALTER DATABASE MyPartitionDB ADD FILE(name='FG3',FILENAME='C:\temp\fg3.ndf') TO FILEGROUP FG3
    ALTER DATABASE MyPartitionDB ADD FILE(name='FG4',FILENAME='C:\temp\fg4.ndf') TO FILEGROUP FG4

    6. Create partition function and scheme

    GO
    -- create partition function
    CREATE PARTITION FUNCTION MyPartitionFunciton (datetime)
    AS RANGE RIGHT FOR VALUES ('20090101', '20100101', '20110101');
    GO
    -- create partition scheme
    CREATE PARTITION SCHEME MypartitionScheme
    AS PARTITION MyPartitionFunciton TO (FG1,FG2,FG3,FG4)
    GO


    7. See current status of our table. Up to now our table is in a default partition. See figure below.






    8. Move table to partition based on LastUpdated column of the table.
    To perform this, I need to drop the index and recreate it on partition scheme that I have created above.

    -- drop existing index
    DROP INDEX mytableToPartition.CL_MYID
    -- re-create index on the partitionscheme
    go
    CREATE CLUSTERED INDEX CL_MYID on mytableToPartition(myid) on MypartitionScheme(run_date)

    Just by creating my clustered index on partition scheme moved all the data in their respective partition. see result set below.



    Let us now see where the our data has gone. The following query will show us the Maximum lastupdated value in particular partition, partition number and total number of rows in each partition. See the output result below.






    In part II, I will show how easy it is to move archived data and able to delete without affecting performance of your system.







    Monday, October 10, 2011

    Why going back to ODBC?

    Yes, that is my question. For the last few years Microsoft was pushing for OLE DB connectivity. Now, microsoft is going to phase out support for OLE DB. The main reason that have been given is portability. Well, why moved from ODBC in the first place. It is also mentioned on the article that the last OLE DB supported database is the next release of SQL Server (Denali). Microsoft have given a timeline when everybody should port thier application to ODBC 7 years. I am not sure why this move is a must. If it does work, why break and create hasle for the microsoft community who have adopted OLE DB?

    Thursday, October 06, 2011

    Transfer sql server logins between different versions

    A very good kb from Microsoft that helps to transfer login between earlier version of SQL Server (7.0 and 2000) to new version. The script and full implication can be found @ Transfer SQL Server logins

    Tuesday, August 09, 2011

    SQL Server Trace flags


    A very comprehensive list of SQL Server trace flags have been put together by Yusuf Anis on SQL Server Trace flag. A good starting point and reference for trace flag,

    Wednesday, August 03, 2011

    SQL Server vs Oracle

    It is a question that has been asked over and over.don't think it will go away any soon. You get different answers from different experts. I learned that generalization is wrong when comparing different RDMS.

    There has been many study conducted to clarify the differences. The more you read the more you are convinced that the word it depends will come to your head. I am as confused as you are but want to share another study by Alinean @ Oracle vs SQL Server.

    I would love to hear your views !!!!!!!!!!

    Saturday, July 16, 2011

    SQL Server Code Name "Denali" CTP3

    The new SQL Server CTP3 has arrived and it is time to play with the new features.

    Tuesday, April 19, 2011

    SQL Server 2008 R2 for Experienced Oracle DBA

    The first course on SQL Server 2008 R2 for Oracle DBA's held in London. This course is very useful not only for Oracle DBA's but also for SQL Server DBA's who want to understand a bit of Oracle database. During a five day course I have been asked many questions from the delegates and it was one of the rewarding experience. This type of course doesn't come so often to UK and I had delegates from all over UK and two delegates from Poland. I recommend anybody who want to learn about SQL Server to attend this course. It is not because I run the course but I genuinely believe it is time and money well spent. The feedback from the delegate was amazing. If you want to read at your own time you can buy the book @SQL Server 2008 for Oracle DBA

    Wednesday, March 16, 2011

    It is not funny

    It is always good to research before trying out. Windows 7 64-bit does not recognize 64-bit CPU in Virtual PC.

    Monday, March 07, 2011

    SQL Server compound statment operator support?

    compound assignment operators. Here is a working example of those operators:

    declare @i int
    set @i = 100

    /**************************
    Addition and assignment
    ***************************/
    set @i += 1
    select @i

    ———–
    101

    /**************************
    Subtraction and assignment
    ***************************/
    set @i -= 1
    select @i

    ———–
    100

    /**************************
    Multiplication and assignment
    ***************************/
    set @i *= 2
    select @i

    ———–
    200

    /**************************
    Division and assignment
    ***************************/
    set @i /= 2
    select @i

    ———–
    100

    /**************************
    Addition and assignment
    ***************************/
    set @i %= 3
    select @i

    ———–
    1

    /**************************
    xor operation and assignment
    ***************************/
    set @i ^= 2
    select @i

    ———–
    3

    /**************************
    Bitwise & operation and assignment
    ***************************/
    set @i &= 2
    select @i

    ———–
    2

    /**************************
    Bitwise | operation and assignment
    ***************************/
    set @i |= 2
    select @i

    ———–
    2

    using SQL Server strongly typed table variable

    The following code is an illustration of how to use strongly typed table variable.

    1. create type
    create type typ as table (id int);

    2. create table
    create table temp(id int not null)

    3. create procedure

    create procedure myproc
    @t typ readonly
    as

    insert into temp
    select * from @t typ

    4. run

    declare @mytype typ
    insert into @mytype values(1), (2), (3)
    exec myproc @mytype

    Microsoft Secure Cloud Service for SQL Server Deployments

    Microsoft just released a configuration assessment cloud service that helps to check your SQL Server configration deployments and enable DBA's proactively avoid configration problems. But for the tool to work it needs to be installed on Windows server box. So, if you want to play with it then you need a server. It will install both gateway and agent. But you only required to install agent if you don't need it to monitor SQL Server 2008.

    To download the new tool or read more you can Read about atlanta (Cloud sql config)

    I definately wouldn't put this product on produciton server but can check on my development and test servers to check if the configration is right. The tool collects all configration information and uploads to microsoft portal.

    First preview of the portal is shown below.

    Wednesday, February 23, 2011

    Table Parameters and Table Types

    A new feature in SQL 2008 is table-valued parameters. You can pass a table variable as a parameter to a stored procedure. When you create your procedure, you don't put the table definition directly in the parameter list of the procedure, instead you first have to create a table type, and use that in the procedure definition. At first glance it may seem like step of extra work, but when you think of it, it makes very much sense: you will need to declare the table in at least two places, in the caller and in the callee. So why not have the definition in one place?

    Here is a quick example that illustrates how you do it:

    CREATE TYPE my_table_type AS TABLE(a int NOT NULL,
    b int NOT NULL)
    go
    CREATE PROCEDURE the_callee @indata my_table_type READONLY AS
    INSERT targettable (col1, col2)
    SELECT a, b FROM @indata
    go
    CREATE PROCEDURE the_caller AS
    DECLARE @data my_table_type
    INSERT @data (a, b)
    VALUES (5, 7)
    EXEC the_callee @data
    go

    So this is the final solution that makes everything else I've talked of in this article of academic interest? Unfortunately, it's the other way round. See that word READONLY in the procedure definition? That word is compulsory with a table parameter. That is, table parameters are for input only, and you cannot use them to get data back. There are of course when input-only tables are of use, but most of the time I share a temp table or use a process-keyed table it's for input-output or output-only.

    Using the cursor Data Type in an OUTPUT Parameter

    A comprehensive example of how to use cursor data type in an output parameter. If you are interested view it @

    Thursday, February 17, 2011

    What is New in SQL Server "Denali" (part II)

    1. Encryption

    SQL Server 2008 R2 supports MD2, MD4, MD5, SHA, or SHA1 hash algorithms for encryption of you data. The new release add support for SHA2_256 and SHA2_512 algorithms. You can use HASHBYTES function as previous version.

    2. User defined server role

    One of the new security features added to Denali is the ability for user now to add user defined server roles which wasn't possible in the previous versions. User can now create, drop, alter user defined server roles.

    3. SQL server security model

    Users don't require logins when access to contained database is permitted. This is a big change and an area that needs to be looked at properly. To understand how this is implemented you can get more info Designing and Implementing a Contained Database

    4. New permission

    Due to the addition of user defined server role, there are also associated permission. Permission to grant, deny and revoke on user defined server roles.

    Monday, February 14, 2011

    What is New in SQL Server "Denali" (part I)

    Part I : Availability and manageability Enhancements

    As we all know microsoft is working on the next generation of SQL Server called Denali. It is at early stages to say what will be released but I would like to go through some of the features.


    1. HADR


    The introduction of the "HADR" solution for enhancing availability of user databases in an enterprise environment. This new enhancement of the database engine will help database administrators to enable to maximize availability for one or more of your user databases. HADR is a high-availability and disaster-recovery solution that provides an enterprise-level alternative to database mirroring. For more information , overview and to deploy, configure and administer HADR please refer to HADR

    2.Combination of BIDS and Management studio


    As we all know SQL Server managment studio was a one stop shop for your SQL server development and administation. The same is also true of Business Intellegence development studio (BIDS). The new version of SQL server will combine the two studio into one IDE. I think this is pretty cool.

    3.Column-Based Query Accelerator

    Column-Based Query Accelerator will help dramatically increase query performance ~10x as per microsoft's claim. I will probably test if this statement is true and will post my results on this blog. Colum base query accelerator will reduce performance tuning through interactive experiences with data for near instant response times and streamlined setup which removes the need to build summary aggregates.

    4.SQL Server Management Studio enhancements

    The Database EngineQuery Editor introduces enhanced functionality for Transact-SQL debugging and IntelliSense. Ability to debug T-SQL running on SQL2005 SP2 and later,
    The Watch window and Quick Watch can now be used to watch T-SQL expressions,
    Moving your cursor over T-SQ identifier will bring up a quick info pop up that displays the name of the expression and its value are just few of many new features that has been introduced in the next version of SQL Server

    5. PowerShell

    Windows powershell is no more part of the SQL server installation but it is part of pre-requisite. I am not sure if this is considered to be a new feature but nice to know.

    6.Contained Databases
    In new version of SQL server when moving a database from one instance of database engine to another instance, the dependancy of users in a contained database no longer associated with the logins on the instance. Microsoft claims that many other depenpendencies on the instance is also removed. For more info on contained database and the terms @read more on contained database

    7. Database engine start-up options

    Database start up option is now configured from SQL server configration manager.

    Thursday, May 13, 2010

    Install SQL server R2 issue

    Today I faced with the following error while trying to install SQL server 2008 R2.
    Sql2005SsmsExpressFacet:Checks whether SQL Server 2005 Express Tools are installed. FailedThe SQL Server 2005 Express Tools are installed. To continue, remove the SQL Server 2005 Express Tools.

    I checked and there was no installation of SQL server express edition.

    I then started looking at the registery and the only thing I need to do was to rename one entry in registry. Find shellSEM in the registery and rename it

    The full path of the registry location is
    HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM

    Finding all SQL server on your network from sql server 2005/08

    By default xp_cmdshell is disabled on SQL server 2005/08. You need to enable this using


    sp_configure 'show advanced options', 1
    GO
    RECONFIGURE
    GO
    sp_configure 'xp_cmdshell', 1
    GO
    RECONFIGURE
    GO


    you can then run OSQL command as follows

    EXEC master..XP_CMDShell 'OSQL -L'

    Friday, December 04, 2009

    sqlcmd 512 characters bug (On SQL server 2008 R2)

    On SQL server 2008 R2 November CTP using sqlcmd to output file will result in truncated characters. I have tried this on my PC numerous times and still not getting more than 512 characters.

    I have used the following command

    sqlcmd -E -S -d master -Q "PRINT REPLICATE('this is testing for more than 512 characters',1000)" -b -o C:\NoMorethan512characters.txt

    The above command produced only 512 characters. After further investigation, I found out that this has been reported as a feedback on Microsoft connect sqlcmd 512 characters still not registered as a bug by Microsoft. I hope this is going to be fixed soon.

    Monday, November 30, 2009

    Transparent Data Encryption (SQL server 2008)

    Transparent Data Encryption (TDE) is a new feature in SQL server 2008.
    TDE is a new feature in SQL Server 2008; it provides real time encryption of data and log files. Data is encrypted before it is written to disk; data is decrypted when it is read from disk. The "transparent" aspect of TDE is that the encryption is performed by the database engine and SQL Server clients are completely unaware of it. There is absolutely no code that needs to be written to perform the encryption and decryption. There are a couple of steps to be performed to prepare the database for TDE, then the encryption is turned on at the database level via an ALTER DATBASE command.

    Friday, November 27, 2009

    SQL Server Management Studio Support for SQL Azure

    Do you know that SQL Server 2008 R2 November CTP have added support for Server Management Studio Support for SQL Azure ? I cannot wait to play with it.

    Microsoft SQL Azure™

    Microsoft SQL Azure is the part of the new windows Azure platform. It seems to me that Microsoft is trying to address, get into and/or use the new hype surrounding cloud computing. I don't see this offering different from oracle on demand that has been there for long. I am not sure also after seeing oracle on demand how good the offering is.

    Microsoft claims that
    SQL Azure Database provides Internet-facing database and advanced query processing services and is the ideal solution for customers building new applications or integrating with existing investments into the cloud.
    I will wait and see.

    Microsoft sql server case studies

    Who start using sql server ? Some eye catching case studies can be found @Microsoft SQL server case studies

    Tuesday, November 24, 2009

    SQL Server 2008: Benchmarks

    Top Ten TPC-E database performance benchmarks carried out by TPC (Transaction processing benchmark council) @ SQL Server 2008: Benchmarks

    SQL Server compared to Oracle

    Microsoft view of comparison between SQL server 2008 and oracle 11G. Microsoft claims that Microsoft® SQL Server® 2008 outperforms Oracle in the areas that matter to business. I am not sure what this mean. But you can see this interesting comparison by Microsoft @SQL Server compared to Oracle

    Monday, November 23, 2009

    Microsoft SQL Server Playback Program

    Microsoft have introduced a Microsoft SQL Server Playback Program. For more information on how the program works you can download and see and view
  • program overview

  • goals of the program

  • if you would be able to participate

  • processes and procedures that is required

  • benefit to customers who participate in the progaram

  • and more can be found @ Microsoft SQL Server Playback Program

    Thursday, November 19, 2009

    Microsoft SQL Server 2008 R2

    What is new in Microsoft SQL Server 2008 R2?

    1. Master Data Services
    Microsoft SQL server 2008 R2 contains a master data management applications. Master data services have got the following tools.

  • Master Data Services Configuration Manager. This configuration manager will help you to create and configure master data services databases and web applications
  • Master data services web service. This component is more useful to developers as they would be able to extend or develop custom solutions for master data services
  • Master Data Manager. This is used by users to manage master data

  • 2. PowerPivot for SharePoint
    Microsoft SQL Server PowerPivot for SharePoint extends SharePoint 2010 and Excel Services to add server-side processing, collaboration, and document management support for the PowerPivot workbooks that you publish to SharePoint.


    3. Multi-Server Administration and Data-Tier Application
    Full details of this new feature can be found @Multi-Server Administration

    4. Support or 256 logical processors


    Support for 256 logical processor is now added in R2 but this requires to be run on Windows 2008 R2. This is a big jump from previous maximum value of 64 processors. Quite a bit jump in my opinion.

    5. Support for visualization of geographic spatial data in Reporting Services
    Support for reports with visual geographic mapping is now supported in SQL Server 2008 R2.

    SQL Server 2008 R2 (CTP)

    The SQL Server Team announced today the release of the SQL Server 2008 R2 November Community Technology Preview (CTP). This is now availabel for download and installation for development and test system.

    The anticipated ship date is going to be the first half of 2010 if things goes as planned.

    To download and view the new features go to SQL Server 2008 R2 (CTP)

    Friday, July 17, 2009

    The Curse and Blessings of Dynamic SQL

    Use dynamic SQL in various version of sql server starting from 6.5, 7.0, 2000, 2005 and 2008. It is indeed a very good reference. To view this click The Curse and Blessings of Dynamic SQL

    Sunday, March 08, 2009

    Is it time to upgrade to SQL server 2008

    I always tend to wait for SP1 to be released before tempting to upgrade prodution servers to new editions of SQL server. Now the CTP for Service Pack 1 of SQL Server 2008 is out, is it the time to upgrade ?

    Project Madison

    Project Madison is Microsoft’s collaborative hardware and software solution for high-end data warehousing. It looks that microsoft is moving agressively into the data warehouseing market. For detailed info on what project Madison you can see the overview @ more on project Madison

    Data Warehousing (SQL server 2008)

    I have heard many times that SQL Server 2008 is revamped in the area of data
    warehousing. In trying to find out what the major areas that can support data warehouse that is different from SQL server 2005 I came accross the following new features in SQL server 20008.

    Apart from the new features that is part of the SQL server release I think the following are the highlights in my opinion.

    - Star join query optimizations
    - Grouping sets
    - MERGE SQL statements
    - Change data capture
    are the once that catch my eyes.

    For detailed info on new features you can view at Introduction to New Data Warehouse Scalability Features in SQL Server 2008 - Technical article

    SQL Server Fast Track Data Warehouse

    On 23rd of Feb 2008, icrosoft announced SQL Server Fast Track Data Warehouse, a new set of Reference Architectures for SQL Server 2008 that enables customers to accelerate their Data Warehouse deployments and reduce cost.

    I would like to hear anybody who have got experience with this. The hightlight of this annoncement is that customers will be able to start data warehouse design with templates provided by Avanade, Hitachi Consulting and Cognizant and HP. Once I looked at them I will love to post how good/user friendly it is and how good the templates are at helping you in acheiving a data warehouse that satisfies your specific business needs.

    As per the anouncement the the highlights are I qoute "

    Seven new Reference Architectures with storage capacities from 4 to 32 TB were unveiled in partnership with HP, Dell and Bull. Developed and tested by Microsoft, these architectures use balanced hardware optimized for Data Warehousing. As a result customers will get

    * Better price performance than competitive solutions. Fast Track Data Warehouse offers similar performance to the competition at 1/5th the price
    * Faster time to value and lower cost to setup and configure
    * Better performance out of box through pre-tested hardware.

    Monday, November 24, 2008

    Name value pair part II

    The article (name value pair part II ) that I published on SQLServerCentral.com is now pulished on best of SQL server central 2008 e-book and can be downloaded from Red-gate software for free.

    Monday, September 15, 2008

    Issues dropping distribution database

    From time to time I came accross when using EM will not completely disable replication leaving distribution database. When you try to drop this database you will get the following error.
    Cannot drop the distribution database 'distribution' because it is currently in use. The way to get around is to follow the following steps


    USE master

    GO
    EXEC sp_configure 'allow updates', '1'
    RECONFIGURE with override
    GO
    update master.dbo.sysdatabases
    set category = 0
    where dbid =

    go
    EXEC sp_configure 'allow updates', '0'
    RECONFIGURE with override

    GO
    drop database


    Thursday, September 04, 2008

    SQL Server 2008

    SQL server 2008 is now shipping !!. To sum up waht is new in SQL server 2008 ?
    The following are some that I have come accross.
    - Automatic Recovery of Data Pages
    - Log Stream Compression
    - Resource Governor
    - Predictable Query Performance
    - Data Compression
    - Hot Add CPU
    - Policy-Based Management
    - Streamlined Installation
    - Performance Data Collection
    - Language Integrated Query (LINQ)
    - ADO.NET Object Services to simplify applicaton development
    - DATE/TIME (Date, Time, Datetimeoffset and datatime2) data type
    - HIERARCHY ID
    - FILESTREAM Data
    - Integrated Full Text Search
    - Sparse Columns (yes new addition)
    - Large User-Defined Types
    - Spatial Data Types
    - Backup Compression
    - Partitioned Table Parallelism
    - Star Join Query Optimizations
    - Grouping Sets
    - Change Data Capture
    - MERGE SQL Statement (I have waited for long for this)
    - SQL Server Integration Services (SSIS) Pipeline Improvements
    - SQL Server Integration Services (SSIS) Persistent Lookups
    - Analysis Scale and Performance
    - Block Computations
    - Writeback (on OLAP)
    - Enterprise Reporting Engine
    - Internet report deployment
    - Manage Reporting Infrastructure
    - Report Builder Enhancements
    - Forms Authentication Support
    - Report Server Application Embedding
    - Microsoft Office Integration
    - Predictive Analysis

    Thursday, June 26, 2008

    SQL Server 2005 cloning

    I have heard a lot on cloning oracle E-business suite. But not SQL Server. Microsoft still lags behind with the idea of cloning. But, I have noticed on Kalen Delaney blog how to do at least some sort of cloning. It is useful that you can script you database with statistics and histogram and able to re-run your execustion plan without loading actaul data. To see detailed info on this visit Kalen's blog on SQL server 2005 Cloning

    Friday, June 13, 2008

    EAV (name value pair)

    part II of EAV or name value pair is now published on SQL Server centeral. Part II will see how to improve a name value pair database that has been implmented to do what a normalised database system should do.

    The article will try to address the main issues that you face when using name value pair such as scalability and difficulty in getting a record out of a database.

    To view full article you can go to Name value pair part II

    Name value Pair

    I have published a new article on name value pair on SQL server central (http://www.sqlservercentral.com/). Part I of the article discusses about the benefits , drawbacks and perception from different angles .

    To view the article click http://www.sqlservercentral.com/articles/Database+Design/62386/

    Thursday, May 15, 2008

    TempDB orignial and current file size

    The following script will help you in finding the file size of current tempdb and the size when SQL server last restarted.

    SELECT
    alt.filename
    ,alt.name
    ,alt.size * 8.0 / 1024.0 AS originalsize_MB
    ,files.size * 8.0 / 1024.0 AS currentsize_MB
    FROM
    master.dbo.sysaltfiles alt INNER JOIN tempdb.dbo.sysfiles files ON
    alt.fileid = files.fileid
    WHERE
    dbid = db_id('tempdb')
    AND alt.size <> files.size

    Saturday, March 15, 2008

    Free Tools for the SQL Server DBA

    Knowing what you don't know will always save you money. Before buying any tool you should consider asking a question, can I get a free tool for my requirement. Search around and analyse . To my surprise I found some companies brand their tool as free but after downloading it turns out to be not free rather free trial version. Don't put off by this. I have done it previously.

    Always begin with an assumption that there is free tool that you could use. Do your research. It will save your company a lot of money and will make you a supremo.

    Note also some of this free tools may not be user friendly. To mention just one SQLIO from Microsoft. It is not a tool that you just click and go. But have used it many times and very satisfied with the result that I got.

    In general, free tools some times can compare with the tools that you spend a lot of money to do the same thing.

    In addition, I came across an article written byDavid Bird for SQL server central and it will cover some of free tools that you will be able to use.

    Monday, January 21, 2008

    Distribution failure due to Data type differences

    Recently I have faced with an issue were the published article column type is different from the subscriber column type. One of the publication articles column data type was varchar and the subscriber table (destination object ) data type was integer. The data in source object support to have a value similar to 012345 where the first character was the number zero and it didn't created any failures until somebody actually put in a value of C12345. This has lead to fail the replication. The only way to get around this was to delete the actual transaction from distribution database.
    I used the following steps to do this:

    use distributiondb
    1. Get an article Id from MSarticles table
    2. run exec sp_browsereplcmds @article_id = 'article Id'
    3. get the xact_seqno of the article that caused this issue
    4. delete the transaction from MSrepl_transactions.
    - delete from MSrepl_transactions where xact_seqno =
    5. delete the replication commands from MSrepl_commands
    - delete MSrepl_commands where xact_seqno =
    6. rerun the distribution agent
    7. fix the route cause
    Note that there is only one entry in MSrepl_transactions while you may have more than one entries in MSrepl_commands.




    Monday, January 14, 2008

    SQL Server 2000 virtual server install fails

    Recently, I have tried to install SQL Server 2000 virtual server on windows server 2003 and the installation fails. I have installed numerous installations on windows 2000 server and never seen such an error. Tried to Google, went to various news groups and have been thinking of what it could be when I have discovered that this is a known issue that has been reported by Microsoft. For details of how to solve this issue go to
    Microsoft help and support page

    Tuesday, October 30, 2007

    SQL Server Survival Guide

    From time to time I refer to this sql server servival guide and would like to share with you. It focuses on SQL server 2000. For more details click SQL Server Survival Guide

    Monday, October 29, 2007

    Transactional replication optimisation

    The following article from microsoft is a good starting point on how to optimise Transactional replication. Click the link for more info.Transactional replication Optimisation

    Monday, October 08, 2007

    Query replicated articles

    Query replicated articles
    If you are using an environment where there many publications and subscriptions it is difficult to find out the list of articles for particular subscriber.

    The following code uses system tables in distribution to accomplish the task.
    This query will retrieve publisher, publication, subscriber database, subsriber_id

    select distinct pub.Publisher_db,pub.Publication, sub.subscriber_db,
    sub.subscriber_id,art.article, art.destination_object from
    distrib_.dbo.MSsubscriptions sub
    join .dbo.MSPublications pub
    on sub.Publication_id = pub.Publication_id
    join .dbo.MSArticles art
    on art.publication_id = pub.publication_id
    where sub.subscriber_id = [subsriber_id]


    If you have multiple distribution databases on the same server you can use union all with pre-fix of database name.

    Tuesday, October 02, 2007

    Removing registered servers

    From time to time your registered servers will get out of date for example if the server is de-commissioned or the instance is removed. Using Enterprise manager some times frustrating. The easiest way to remove your registered server is by removing it from registry. The following step will help you how to do this.

    a. Go to start menu and click run
    b. Enter Regedit and click Ok
    c. The registery editor will come up
    d. Click on HK_Users and go to edit menu and click find
    e. Type in Registered Servers X
    f. Find the registered server from the list and delete

    Tuesday, September 18, 2007

    Adding the article's partition column(s)

    Procedure to add articles partition column
    exec sp_articlecolumn
    @publication = N'PublicationName', @article = N'ArticleName', @column = N'ColumnName', @operation = N'add'
    GO

    Thursday, September 13, 2007

    Windows & SQL cluster

    The following are usefull links if you are planning to do Windows & SQL cluster clustering project.
    - Troubleshooting cluster node installations
    - Designing and Deploying Clusters
    - latest information about windows 2003
    - Quorum Drive Configuration Information
    - Recommended private 'Heartbeat' configuration on a cluster server
    - Network Failure Detection and Recovery in a Server Cluster
    -How to Change Quorum Disk Designation
    - Server Clusters : Storage Area Networks

    Password expiration dates

    I have various questions from different people asking me how to set password expiration in previous version of sql server (2000 and 7). While trying to find out a way of setting password expiration, I have come accross this article from microsoft.
    To view details of how to do this click How to implement password expiration dates for SQL Server 2000 or SQL Server 7.0 login IDs.