Showing posts with label retrieve. Show all posts
Showing posts with label retrieve. Show all posts

Thursday, March 22, 2012

computed column formula

Is it possible to retrieve the formula associated with a computed column using t-SQL? I can use COLUMNPROPERTY( id, column, 'IsComputed') to find the computed columns, but how do I get the formula itself?

Thanks,

Mable

sp_helptext 'TableName', 'Computed Column Name'

For eg


CREATE TABLE T(i int, j AS i *2)

INSERT INTO T(i) VALUES(10)
SELECT * FROM T

sp_helptext 'T', 'j'

|||

Thank you! That is just what I needed.

--Mable

computed column formula

Is it possible to retrieve the formula associated with a computed column using t-SQL? I can use COLUMNPROPERTY( id, column, 'IsComputed') to find the computed columns, but how do I get the formula itself?

Thanks,

Mable

sp_helptext 'TableName', 'Computed Column Name'

For eg


CREATE TABLE T(i int, j AS i *2)

INSERT INTO T(i) VALUES(10)
SELECT * FROM T

sp_helptext 'T', 'j'

|||

Thank you! That is just what I needed.

--Mable

Thursday, March 8, 2012

Complex Table Problem

I know you can't have a table bound to 2 datasets so what I need is a way to
allow the user to retrieve some results for this year, and then side-by-side
with each column, the results for the previous year are also shown. I have
the parameters, etc working OK, I just need to find a way to get the columns
in the table setup.
EXAMPLE DATA FROM TABLE
Year Dept Applications Interviews
---
2003/4 Admin 56 37
2003/4 HR 12 9
2004/5 Admin 15 3
2004/5 HR 5 1
HOW THE REPORT SHOULD LOOK
Applications Interviews
Team 2003/4 2004/5 2003/4 2004/5
---
Admin 56 15 37 3
HR 12 5 9 1
Can anybody offer any advice on how I can achieve this?
Thanks.On Thu, 18 Nov 2004 01:47:01 -0800, Mark Parter
<MarkParter@.discussions.microsoft.com> wrote:
> EXAMPLE DATA FROM TABLE
> Year Dept Applications Interviews
> ---
> 2003/4 Admin 56 37
> 2003/4 HR 12 9
> 2004/5 Admin 15 3
> 2004/5 HR 5 1
> HOW THE REPORT SHOULD LOOK
> Applications Interviews
> Team 2003/4 2004/5 2003/4 2004/5
> ---
> Admin 56 15 37 3
> HR 12 5 9 1
> Can anybody offer any advice on how I can achieve this?
you can't do that in RS, you have to write new select/procedure.
I think you can use INNER JOIN for that.
--
Ing. Branislav Gerzo|||Tis Ok, I've managed to sort it out myself.
"Mark Parter" wrote:
> I know you can't have a table bound to 2 datasets so what I need is a way to
> allow the user to retrieve some results for this year, and then side-by-side
> with each column, the results for the previous year are also shown. I have
> the parameters, etc working OK, I just need to find a way to get the columns
> in the table setup.
> EXAMPLE DATA FROM TABLE
> Year Dept Applications Interviews
> ---
> 2003/4 Admin 56 37
> 2003/4 HR 12 9
> 2004/5 Admin 15 3
> 2004/5 HR 5 1
> HOW THE REPORT SHOULD LOOK
> Applications Interviews
> Team 2003/4 2004/5 2003/4 2004/5
> ---
> Admin 56 15 37 3
> HR 12 5 9 1
> Can anybody offer any advice on how I can achieve this?
> Thanks.
>
>|||That's easy. It is a matrix. column group one is activity(App/Interview)
column group 2 is year
Row group is Department.
"Ing. Branislav Gerzo" wrote:
> On Thu, 18 Nov 2004 01:47:01 -0800, Mark Parter
> <MarkParter@.discussions.microsoft.com> wrote:
> > EXAMPLE DATA FROM TABLE
> >
> > Year Dept Applications Interviews
> > ---
> > 2003/4 Admin 56 37
> > 2003/4 HR 12 9
> > 2004/5 Admin 15 3
> > 2004/5 HR 5 1
> >
> > HOW THE REPORT SHOULD LOOK
> >
> > Applications Interviews
> > Team 2003/4 2004/5 2003/4 2004/5
> > ---
> > Admin 56 15 37 3
> > HR 12 5 9 1
> >
> > Can anybody offer any advice on how I can achieve this?
> you can't do that in RS, you have to write new select/procedure.
> I think you can use INNER JOIN for that.
> --
> Ing. Branislav Gerzo
>