Converting from hex string to varbinary and vice versa

Converting hexadecimal values to varbinary and vice versa is now easier using the XQuery functionality available from SQL Server 2005. The code samples below show how to perform the conversion(s): — Convert hexstring value in a variable to varbinary: declare @hexstring varchar(max); set @hexstring = ‘abcedf012439’; select cast(” as xml).value(‘xs:hexBinary( substring(sql:variable("@hexstring"), sql:column("t.pos")) )’, ‘varbinary(max)’) from…

5

Converting from Base64 to varbinary and vice versa

Converting Base64 values to varbinary and vice versa is now easier using the XQuery functionality available from SQL Server 2005 onwards. The code samples below show how to perform the conversion: — Convert Base64 value in a variable to varbinary: declare @str varchar(20); set @str = ‘3qAAAA==’; select cast(N” as xml).value(‘xs:base64Binary(sql:variable("@str"))’, ‘varbinary(20)’); — Convert binary…

2

Differences between ISNULL and COALESCE

I came across a question in the SQL Server MVP newsgroup recently about ISNULL and COALESCE usage. COALESCE basically translates to CASE expression and ISNULL is a built-in implemented in the database engine. Both ISNULL and COALESCE can be used to get the same results but there are some differences. 1. Data type determination of…

8

Spool operators in query plan…

I came across a question in the relationalserver.performance newsgroup where a customer was wondering about the spools seen in a recursive query execution plan. The query is shown below: USE Northwind;Go WITH EmpChart AS(SELECT EmployeeId, ReportsTo, 1 AS treelevelFROM EmployeesWHERE (Employees.ReportsTo = 2)UNION ALLSELECT e.EmployeeId, e.ReportsTo, treelevel +1FROM Employees eJOIN EmpChart ecON e.ReportsTo=ec.EmployeeID)SELECT * FROM…

3

SQL Server 2005 SP2 Re-release and post fixes

Bob Ward from PSS has a wonderful blog article that explains the details about the re-release of SQL Server 2005 SP2 and fixes posted later. This is a must read for anyone deploying SQL Server 2005 SP2 to understand the various hotfixes, GDRs and procedures. Please visit his link for more details. SQL Server 2005…

1

New MSDN Books Online search functionality

Check out the new Books Online search functionality online. The link below provides  a scoped search of Books Online that returns a more precise and targeted result set. You can use it to search Books Online content quickly. http://search.live.com/macros/sql_server_user_education/booksonline Please direct your feedback to SQLServerUE@hotmail.com. — Umachandar

1

SQL Server 2005 Performance Dashboard Reports

The SQL Server 2005 Performance Dashboard Reports are Reporting Services report files designed to be used with the Custom Reports feature introduced in the SQL Server 2005 SP2 release of SQL Server Management Studio. The reports allow a database administrator to quickly identify whether there is a current bottleneck on their system, and if a…

1

OBJECT_NAME enhancement and OBJECT_SCHEMA_NAME addition in SQL Server 2005 SP2

SQL Server 2005 SP2 has an important enhancement to OBJECT_NAME metadata function and a new OBJECT_SCHEMA_NAME metadata function. I will first describe the old functionality to give some context and demonstrate how the new features help a lot. Please note that the examples uses DMVs that looks at metadata in each database or plan cache so…

2

SQL Server Performance Engineering Team Blog

I would like to announce the blog from my team – SQL Server Performance Engineering. Feel free to visit our blog at http://blogs.msdn.com/sqlperf for your performance related questions and needs. Use the email link in the home page to share your feedback on performance and topics of interest. — Umachandar Jayachandran

1

SQL Server 2005 SP2 has been released…

SQL Server 2005 Service Pack 2 has been released. You can find more information from the service pack 2 page. This service pack extends the functionality of SQL Server in many ways. The What’s New document highlights the major changes in the Database Engine, Analysis Services, Integration Services and others. The service pack also has…

1