Showing posts with label excludes. Show all posts
Showing posts with label excludes. Show all posts

Wednesday, March 21, 2012

Excludes 'Z' while giving LIKE '[A-Z]%' but works fine for all other combinations

Hai Friends!

I have a peculiar problem while using LIKE pattern match with SQL Server 2005. My requirement is to list names starting from a range of Characters (anything from a to z). If I want to list Names starting from A to Z I am giving the LIKE pattern as LIKE '[A-Z]%' but the result set contains names starting with 'A' alone. If I give '[B-Z]%' the 'B' Alone is included in the result set. For all remaining combinations (ex: '[A-Y]%') it gives correct results.

If I give '[Z]%' or 'Z%' it gives all starting with Z correctly. If I include the Z with any other alphabet it takes only the starting alphabet and excludes all remaining letters.

This problem seems to be too strange and couldn't understand why it gives wrong results!!

Any solutions? Thanks in advance

Visualcpp

Please list your specific syntax; the following works fine:

select aName
from ( select 'Alphabet' as aName
union all
select 'Zymurgy'
) a
where aName like '[A-Z]%'

-- aName
-- --
-- Alphabet
-- Zymurgy

exclude system tables in metadata

I want to get a list of user tables that excludes dtproperties and
sysdiagrams. In Management Studio these two tables show up in their own
Tables > System Tables folder.
However, both sys.tables and INFORMATION_SCHEMA.TABLES include dtproperties
and sysdiagrams as user tables, and there are no columns in either of these
views to differentiate these tables from true user tables.
Is there any way to exclude these two annoying tables using selection
criteria in any of the standard metadata views? How does Management Studio
do it?
Oops, just saw sys.tables.is_ms_shipped = 1 for these guys. Never mind...
"Dana" wrote:

> I want to get a list of user tables that excludes dtproperties and
> sysdiagrams. In Management Studio these two tables show up in their own
> Tables > System Tables folder.
> However, both sys.tables and INFORMATION_SCHEMA.TABLES include dtproperties
> and sysdiagrams as user tables, and there are no columns in either of these
> views to differentiate these tables from true user tables.
> Is there any way to exclude these two annoying tables using selection
> criteria in any of the standard metadata views? How does Management Studio
> do it?
|||Dana,
If you don't use SQL Server to maintain ER diagrams I believe you can delete
both tables without consequence. Otherwise, excluding them in the predicate
is the only way I know of.
-- Bill
"Dana" <Dana@.discussions.microsoft.com> wrote in message
news:B7ACAF22-6FAE-4364-B4C3-5673CCFC9AE0@.microsoft.com...
>I want to get a list of user tables that excludes dtproperties and
> sysdiagrams. In Management Studio these two tables show up in their own
> Tables > System Tables folder.
> However, both sys.tables and INFORMATION_SCHEMA.TABLES include
> dtproperties
> and sysdiagrams as user tables, and there are no columns in either of
> these
> views to differentiate these tables from true user tables.
> Is there any way to exclude these two annoying tables using selection
> criteria in any of the standard metadata views? How does Management
> Studio
> do it?
|||Good to know, Dana.
"Dana" <Dana@.discussions.microsoft.com> wrote in message
news:8162BD94-2F40-4D31-BCE9-0D3BB27AD3E1@.microsoft.com...[vbcol=seagreen]
> Oops, just saw sys.tables.is_ms_shipped = 1 for these guys. Never
> mind...
> "Dana" wrote:

exclude system tables in metadata

I want to get a list of user tables that excludes dtproperties and
sysdiagrams. In Management Studio these two tables show up in their own
Tables > System Tables folder.
However, both sys.tables and INFORMATION_SCHEMA.TABLES include dtproperties
and sysdiagrams as user tables, and there are no columns in either of these
views to differentiate these tables from true user tables.
Is there any way to exclude these two annoying tables using selection
criteria in any of the standard metadata views? How does Management Studio
do it?Oops, just saw sys.tables.is_ms_shipped = 1 for these guys. Never mind...
"Dana" wrote:
> I want to get a list of user tables that excludes dtproperties and
> sysdiagrams. In Management Studio these two tables show up in their own
> Tables > System Tables folder.
> However, both sys.tables and INFORMATION_SCHEMA.TABLES include dtproperties
> and sysdiagrams as user tables, and there are no columns in either of these
> views to differentiate these tables from true user tables.
> Is there any way to exclude these two annoying tables using selection
> criteria in any of the standard metadata views? How does Management Studio
> do it?|||Dana,
If you don't use SQL Server to maintain ER diagrams I believe you can delete
both tables without consequence. Otherwise, excluding them in the predicate
is the only way I know of.
-- Bill
"Dana" <Dana@.discussions.microsoft.com> wrote in message
news:B7ACAF22-6FAE-4364-B4C3-5673CCFC9AE0@.microsoft.com...
>I want to get a list of user tables that excludes dtproperties and
> sysdiagrams. In Management Studio these two tables show up in their own
> Tables > System Tables folder.
> However, both sys.tables and INFORMATION_SCHEMA.TABLES include
> dtproperties
> and sysdiagrams as user tables, and there are no columns in either of
> these
> views to differentiate these tables from true user tables.
> Is there any way to exclude these two annoying tables using selection
> criteria in any of the standard metadata views? How does Management
> Studio
> do it?|||Good to know, Dana.
"Dana" <Dana@.discussions.microsoft.com> wrote in message
news:8162BD94-2F40-4D31-BCE9-0D3BB27AD3E1@.microsoft.com...
> Oops, just saw sys.tables.is_ms_shipped = 1 for these guys. Never
> mind...
> "Dana" wrote:
>> I want to get a list of user tables that excludes dtproperties and
>> sysdiagrams. In Management Studio these two tables show up in their own
>> Tables > System Tables folder.
>> However, both sys.tables and INFORMATION_SCHEMA.TABLES include
>> dtproperties
>> and sysdiagrams as user tables, and there are no columns in either of
>> these
>> views to differentiate these tables from true user tables.
>> Is there any way to exclude these two annoying tables using selection
>> criteria in any of the standard metadata views? How does Management
>> Studio
>> do it?

exclude system tables in metadata

I want to get a list of user tables that excludes dtproperties and
sysdiagrams. In Management Studio these two tables show up in their own
Tables > System Tables folder.
However, both sys.tables and INFORMATION_SCHEMA.TABLES include dtproperties
and sysdiagrams as user tables, and there are no columns in either of these
views to differentiate these tables from true user tables.
Is there any way to exclude these two annoying tables using selection
criteria in any of the standard metadata views? How does Management Studio
do it?Oops, just saw sys.tables.is_ms_shipped = 1 for these guys. Never mind...
"Dana" wrote:

> I want to get a list of user tables that excludes dtproperties and
> sysdiagrams. In Management Studio these two tables show up in their own
> Tables > System Tables folder.
> However, both sys.tables and INFORMATION_SCHEMA.TABLES include dtpropertie
s
> and sysdiagrams as user tables, and there are no columns in either of thes
e
> views to differentiate these tables from true user tables.
> Is there any way to exclude these two annoying tables using selection
> criteria in any of the standard metadata views? How does Management Studi
o
> do it?|||Dana,
If you don't use SQL Server to maintain ER diagrams I believe you can delete
both tables without consequence. Otherwise, excluding them in the predicate
is the only way I know of.
-- Bill
"Dana" <Dana@.discussions.microsoft.com> wrote in message
news:B7ACAF22-6FAE-4364-B4C3-5673CCFC9AE0@.microsoft.com...
>I want to get a list of user tables that excludes dtproperties and
> sysdiagrams. In Management Studio these two tables show up in their own
> Tables > System Tables folder.
> However, both sys.tables and INFORMATION_SCHEMA.TABLES include
> dtproperties
> and sysdiagrams as user tables, and there are no columns in either of
> these
> views to differentiate these tables from true user tables.
> Is there any way to exclude these two annoying tables using selection
> criteria in any of the standard metadata views? How does Management
> Studio
> do it?|||Good to know, Dana.
"Dana" <Dana@.discussions.microsoft.com> wrote in message
news:8162BD94-2F40-4D31-BCE9-0D3BB27AD3E1@.microsoft.com...[vbcol=seagreen]
> Oops, just saw sys.tables.is_ms_shipped = 1 for these guys. Never
> mind...
> "Dana" wrote:
>