Thursday, May 24, 2012

Query To get list of deprecated features in SQL Server 2008

We can get the list of deprecated features in SQL Server 2008 with a simple query.

SELECT * FROM sys.dm_os_performance_counters WHERE OBJECT_NAME like '%deprecated%' order by cntr_value desc

Thursday, March 29, 2012

Read XML From Large File

DECLARE @xmlFileName VARCHAR(300)
SELECT @xmlFileName = 'D:\Desc\desc2012.xml.part2.xml'

EXEC('
INSERT INTO XmlImportTest(xmlFileName, xml_data)

SELECT ''' + @xmlFileName + ''', xmlData
FROM
(
SELECT *
FROM OPENROWSET (BULK ''' + @xmlFileName + ''' , SINGLE_BLOB) AS XMLDATA
) AS FileImport (XMLDATA)
')
GO


If DTD Error occurred use following code

DECLARE @xmlFileName VARCHAR(300)
SELECT @xmlFileName = 'D:\Desc\desc2012.xml.part2.xml'

EXEC('
INSERT INTO XmlImportTest(xmlFileName, xml_data)

SELECT ''' + @xmlFileName + ''', xmlData
FROM
(
SELECT CONVERT(xml, BulkColumn, 2)
FROM OPENROWSET (BULK ''' + @xmlFileName + ''' , SINGLE_BLOB) AS XMLDATA
) AS FileImport (XMLDATA)
')
GO

SQL Server 2012 Tutorials and Sample Databases

Microsoft SQL Server 2012 has released RTM recently. No doubt that you're interested to learn new features of the new version. If so then it is useful to have the tutorials and sample databases installed on your server. You can get them using below links;

Tutorials here

Sample Databases here

Note that sample databases are just data files (No log file). You need to attach it to your server to create the databases. Use the following T-SQL script.

CREATE DATABASE AdventureWorks2012
ON (FILENAME = 'D:\SQL Server\DATA\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG

Enjoy with the new version of SQL Server.