Re: Meta data of query?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Dan Guzman (danguzman_at_nospam-earthlink.net)
Date: 07/11/04


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


Relevant Pages

  • Re: Cant Explain This In Few Words
    ... The initial query I ... In this case here Day01 has the precip value for day one, ... Unit for Temp Data is either C or F. For precip it's Inches. ... >>thing I did was build queries to pull a specific element. ...
    (microsoft.public.access.queries)
  • Re: Delete matching records from two tables
    ... about what to delete and then run separate delete queries on each table. ... Create a temp table with doc_suffix, tax_id, doc_id fields (we'll come ... create an append query that adds the 3 fields from currently matching ... Maketable each time is to avoid having saved queries refer to a table that ...
    (microsoft.public.access.queries)
  • Re: UNION ALL
    ... "Samora" wrote in message ... You are losing the order because you have no ORDER BY clause in your query. ... Only queries and only if you use ORDER BY. ... write data to a temp table (if you prefer no code, ...
    (microsoft.public.access.gettingstarted)
  • Re: Querydef
    ... converts all codes to lower case to eliminate the possibility of duplicates. ... The temp table in turn links to SQL Server tables to extract data. ... I need to find which queries have the temp table to edit the SELECT ... If the table has no fields in the query, I don't see how you can get the ...
    (microsoft.public.access.modulesdaovba)
  • Re: deleting columns in table
    ... All you need is two queries, ... To delete the contents of the temp table, you need a Delete query: ... I want that my macro ...
    (microsoft.public.access.modulesdaovba)