Showing posts with label particular. Show all posts
Showing posts with label particular. Show all posts

Friday, March 30, 2012

print header on the first page only

I have a table grouped by id. The detail for a particular group can span
serveral pages.
I have 3 header lines for each group . I want to print all 3 header rows on
the first page of the group and only one of the header rows on the next pages
of the group.
Does any one know how to do this?
--
MarieI found a solution here.
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=150&messageid=227646
--
Marie
"Marie" wrote:
> I have a table grouped by id. The detail for a particular group can span
> serveral pages.
> I have 3 header lines for each group . I want to print all 3 header rows on
> the first page of the group and only one of the header rows on the next pages
> of the group.
> Does any one know how to do this?
> --
> Marie

Wednesday, March 21, 2012

Primary key details

I am looking for a query to get the PrimaryKey Name, primary key column
for a particular table.
The follwing query will give me the Key Name and the Table Name but not
the column Name. Can I get the column name also in this query.
select A.ID,A.Name as PrimaryKey, B.Name as MasterTable from sysobjects
A INNER JOIN sysobjects B
on A.Parent_obj= B.ID
where A.xType = 'PK'
Thanks in AdvanceWhat about
SELECT * from INFORMATION_SCHEMA.KEY_COLUMN_USAGE
HTH, Jens Suessmeyer.|||SQL novice
SELECT rc.constraint_name,
ccu_prim.TABLE_NAME AS prim_table,
ccu_prim.COLUMN_NAME AS prim_column,
ccu_for.TABLE_NAME AS for_table,
ccu_for.COLUMN_NAME AS for_column
FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu_prim
INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
ON ccu_prim.CONSTRAINT_CATALOG = rc.UNIQUE_CONSTRAINT_CATALOG
AND ccu_prim.CONSTRAINT_SCHEMA = rc.UNIQUE_CONSTRAINT_SCHEMA
AND ccu_prim.CONSTRAINT_NAME = rc.UNIQUE_CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu_for
ON ccu_for.CONSTRAINT_CATALOG = rc.CONSTRAINT_CATALOG
AND ccu_for.CONSTRAINT_SCHEMA = rc.CONSTRAINT_SCHEMA
AND ccu_for.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
ORDER BY rc.constraint_name, for_table, prim_column
"SQL novice" <balacr@.gmail.com> wrote in message
news:1132221814.286212.141430@.g14g2000cwa.googlegroups.com...
>I am looking for a query to get the PrimaryKey Name, primary key column
> for a particular table.
> The follwing query will give me the Key Name and the Table Name but not
> the column Name. Can I get the column name also in this query.
> select A.ID,A.Name as PrimaryKey, B.Name as MasterTable from sysobjects
> A INNER JOIN sysobjects B
> on A.Parent_obj= B.ID
> where A.xType = 'PK'
>
> Thanks in Advance
>|||you could use 'sp_help <nametable>' which will inform you about that.
"SQL novice" wrote:

> I am looking for a query to get the PrimaryKey Name, primary key column
> for a particular table.
> The follwing query will give me the Key Name and the Table Name but not
> the column Name. Can I get the column name also in this query.
> select A.ID,A.Name as PrimaryKey, B.Name as MasterTable from sysobjects
> A INNER JOIN sysobjects B
> on A.Parent_obj= B.ID
> where A.xType = 'PK'
>
> Thanks in Advance
>|||Thanks Jens and Uri,
This was very helpful.