Wednesday, March 7, 2012

query on text columns

How can I query to find out on which filegroup is a TEXT column created.
The following query lists out all text columns in the database, but does not
tell which FILEGROUPS has it been created.
select t.name as table_name,
c.name as text_column
from sysobjects t, syscolumns c
where t.id = c.id
and t.type = 'U'
and c.type = 35
order by table_name,text_columnSee if this helps:
use northwind
go
select
object_name(si.[id]) as table_name,
sfg.groupname as text_file_group
from
sysindexes as si
inner join
sysfilegroups as sfg
on si.groupid = sfg.groupid
where
si.indid = 255
and object_name(si.[id]) = 'employees'
go
AMB
"Data Cruncher" wrote:
> How can I query to find out on which filegroup is a TEXT column created.
> The following query lists out all text columns in the database, but does not
> tell which FILEGROUPS has it been created.
> select t.name as table_name,
> c.name as text_column
> from sysobjects t, syscolumns c
> where t.id = c.id
> and t.type = 'U'
> and c.type = 35
> order by table_name,text_column
>|||Yes it works.
thanks.
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:571E8950-9C91-4A65-9E52-54359D678DF1@.microsoft.com...
> See if this helps:
> use northwind
> go
> select
> object_name(si.[id]) as table_name,
> sfg.groupname as text_file_group
> from
> sysindexes as si
> inner join
> sysfilegroups as sfg
> on si.groupid = sfg.groupid
> where
> si.indid = 255
> and object_name(si.[id]) = 'employees'
> go
>
> AMB
>
> "Data Cruncher" wrote:
>> How can I query to find out on which filegroup is a TEXT column created.
>> The following query lists out all text columns in the database, but does not
>> tell which FILEGROUPS has it been created.
>> select t.name as table_name,
>> c.name as text_column
>> from sysobjects t, syscolumns c
>> where t.id = c.id
>> and t.type = 'U'
>> and c.type = 35
>> order by table_name,text_column

No comments:

Post a Comment