Share via


Using SQL-DMO Multistrings

This feature will be removed in the next version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

SQL Distributed Management Objects (SQL-DMO) multistrings are used in numerous parameters in SQL-DMO properties and methods. Using multistrings, a user can supply one or more delimited strings to the parameter, and SQL-DMO parses the input into multiple strings.

Database objects in instances of Microsoft SQL Server version 6.5 and earlier could not contain special characters such as spaces, commas, and semicolons. Therefore, these characters could be used interchangeably as string delimiter characters. For example, this multistring contains four separate strings:

S1 S2,S3;S4

However, database objects in instances of SQL Server version 7.0 and later can contain any characters valid in the underlying operating system, including spaces, commas, and semicolons. To accommodate this change, SQL-DMO multistring format uses left and right brackets ([]) as delimiters. The use of spaces, commas, and semicolons between bracketed strings is optional. For example these two multistrings, which contain four strings, are identical:

[S1] [S2] [S3] [S4]
[S1] [S2],[S3];[S4]

A right bracket is used as the escape character for a string that contains a right bracket. For example, the string "My]object" should be specified as:

[My]]object]

No escape character is required for a left bracket because SQL-DMO parses multistrings from left to right.

To maintain backward compatibility, the original multistring format is still supported if the string does not contain any spaces, commas, semicolons, or brackets. If an application uses the newer multistring format for one string, then the same format must be used for all strings in the multistring parameter.

SQL-DMO multistrings are used by these properties and methods: