Re: Meta data of query?
From: Dan Guzman (danguzman_at_nospam-earthlink.net)
Date: 07/11/04
- Next message: Dan Guzman: "Re: Meta data of query?"
- Previous message: Claudiney: "Query performance"
- In reply to: LCaffrey: "Re: Meta data of query?"
- Next in thread: LCaffrey: "Re: Meta data of query?"
- Reply: LCaffrey: "Re: Meta data of query?"
- Reply: LCaffrey: "Re: Meta data of query?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 11 Jul 2004 17:28:14 -0500
> I find that ...
> SELECT (col_list) from personal_details where 1 = 0
> ... is a much more effective way of getting the query description.
Not sure what you mean by 'effective' but that method is functionally
identical.
> Dan, some points w.r.t. your suggestion...
> 1. > WHERE
> > OBJECT_ID(QUOTENAME('dbo') + '.' + QUOTENAME(TABLE_NAME)) =
> > OBJECT_ID('tempdb.dbo.#MetaData')
>
> ...I presume that this is a typo and that you meant...
>
> > OBJECT_ID(QUOTENAME('dbo') + '.' + QUOTENAME(#MetaData)) =
>
> However, this is not possible because '#MetaData' is not the actual
> name of the temp table.
> The only way I can get around this is to use '... LIKE '#MetaData%'
> which works fine.
Did you try the original query I posted? It ought to work without
modification because both references to the temp table name resolve to the
name internally generated by SQL Server. No need to use LIKE here.
> 2. Each column must be named explicitly or resolve to a proper name
> (e.g. aggregate columns must have a name - I haven't tried complex
> queries with inline views and group by, etc...
>
> 3. Embedded strings must be gsub'ed.
As I mentioned in my original response, it is best to do this in application
code.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"LCaffrey" <lxc@eosys.ie> wrote in message
news:4a6dded0.0407111259.670f1f84@posting.google.com...
> Thanks guys, this is very nice...
>
> A few points...
>
> I find that ...
> SELECT (col_list) from personal_details where 1 = 0
> ... is a much more effective way of getting the query description.
>
> Dan, some points w.r.t. your suggestion...
> 1. > WHERE
> > OBJECT_ID(QUOTENAME('dbo') + '.' + QUOTENAME(TABLE_NAME)) =
> > OBJECT_ID('tempdb.dbo.#MetaData')
>
> ...I presume that this is a typo and that you meant...
>
> > OBJECT_ID(QUOTENAME('dbo') + '.' + QUOTENAME(#MetaData)) =
>
> However, this is not possible because '#MetaData' is not the actual
> name of the temp table.
> The only way I can get around this is to use '... LIKE '#MetaData%'
> which works fine.
>
>
> 2. Each column must be named explicitly or resolve to a proper name
> (e.g. aggregate columns must have a name - I haven't tried complex
> queries with inline views and group by, etc...
>
> 3. Embedded strings must be gsub'ed.
>
> Thanks for your help
>
> Dynamically generated web pages based on user queries, here we go....
>
> Liam Caffrey
- Next message: Dan Guzman: "Re: Meta data of query?"
- Previous message: Claudiney: "Query performance"
- In reply to: LCaffrey: "Re: Meta data of query?"
- Next in thread: LCaffrey: "Re: Meta data of query?"
- Reply: LCaffrey: "Re: Meta data of query?"
- Reply: LCaffrey: "Re: Meta data of query?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|