:::: MENU ::::

Posts Categorized / System Functions

  • Jun 30 / 2009
  • 0
dbDigger, System Functions

Invalid length parameter passed to the %ls function.

Following error message
Msg 536, Level 16, State 1, Line 3
Invalid length parameter passed to the %ls function.

is run time error message and appears on all versions of SQL Server, when you call a string function with an invalid length parameter. The invalid length parameter may be verified and corrected to solve the error.

Following is example of such error

SET @c = ‘Hello World’

The above example tries to extract a SUBSTRING of length -1 from the string @c. This raises the error.

  • Jun 04 / 2009
  • 0
DBA Interview questions, dbDigger, System Functions

Get name of your SQL Server instance

There may be a requirement to get exact name of any SQL Server instance. There are some ways to accomplish this task. Any of these ways can be usedn>

SELECT @@servername

Or system table sys.sysservers or sysservers may be queried to get the name of instance. However this table is contains one row for each server that an instance of SQL Server can access. So there may be records for linked servers in it.

  • May 21 / 2009
  • 0
reinvent the wheel
DBA thoughts, DBCC Commands, dbDigger, System Functions, System Stored Procedures

Choosing between system objects and customized scripts

Most of the times i am amazed to notice that there are several commands, stored procedures and functions provided by SQL Server that may be effectively used during several tasks. We know these objects as DBCC commands, system stored procedures, DMVs, and system functions. For efficiency and effectiveness it is important for a DBA to get update of all such system provided objects. It would prevent the reinvention of wheel.

  • Click here to get list of SQL Server T-SQL system stored procedures
  • Click here to get list of SQL Srever T-SQL system functions
  • Click here to get list of SQL Srever T-SQL DBCC commands
Consult us to explore the Databases. Contact us