Home » 2012 » July (Page 3)

Monthly Archives: July 2012

Procedure xp_cmdshell expects parameter ‘command_string’ of type ‘varchar’.

You can’t use varchar(max) with xp_cmdshell. Try a finite number (0 to 8000). varchar(max) is having capacity of 2GB & works as TEXT data type in background.

How to Insert datetime with different Timezones

In SQL Server 2008, Microsoft has introduced a number of new date and time data types. One of these is the datetimeoffset data type. This data type includes an offset from UTC time as well as the datetime value and ensures that the datetime can be retrieved in UTC or a particular timezone based on … Continue reading

xp_readerrorlog V/S sp_readerrorlog parameters in SQL Server 2012

The parameters syntax has been changed in SQL Server 2012 but not documented yet. Syntax Before SQL Server 2012 SQL Server 2012 sp_readerrorlog 0,1,’node’ Supported Supported xp_readerrorlog 0,1, ‘node’     xp_readerrorlog 0,1,N’node’ Supported       Supported Not Supported Msg 22004, Level 12, State 1, Line 0 Error executing extended stored procedure: Invalid Parameter … Continue reading

Query Execution Plan from XML to Graphical View

Convert Your SQL Server Query Execution Plan from XML to Graphical View 1) We can get queries execution plan from below query SELECT QS.*, CP.* FROM SYS.DM_EXEC_QUERY_STATS AS QS CROSS APPLY SYS.DM_EXEC_SQL_TEXT(SQL_HANDLE)AS ST CROSS APPLY SYS.DM_EXEC_QUERY_PLAN(PLAN_HANDLE) AS CP 2) Column query_plan is having execution plan in XML form 3) When we click hyperlink in query_plan … Continue reading

Genrate Database User Script with access rights

From last some time I am getting regular reuirment of DB restore from PROD TO UAT or DEV environment. All server having different domain & different user ids in databse. I have right small script for the same to get user creation script with access rights in one go. SET NOCOUNT ON GO CREATE TABLE … Continue reading

%d bloggers like this: