SQL '#' means what?

Punice

Registered User.
Local time
Today, 10:56
Joined
May 10, 2010
Messages
135
Saw this sql & want to use it. Problem: what does the '#' mean/do preceding the 'a' & 'b'? That's all. TIA

SELECT a.i
FROM #a AS a WHERE a.i NOT IN (SELECT b.j FROM #b AS b) OR a.i IS NULL;
 
Here is info:
http://weblogs.sqlteam.com/peterl/a...n-one-table-not-present-in-another-table.aspx

The basic idea is to get all records from * table #a where the value in column i is either NULL or not present in column j of * table #b. What basically happens behind the scene is that the NOT IN part creates a list of values and stores them in a temporary table and then matches the values from column i in table #a against this temporary table. If there is not a match, or value from table #a is NULL, the column value is valid and returned to query.

*They are just table names

Seems SQL server accepts that naming. I'm not a SQL server user.

Good luck.
 
Last edited:
In what context did you see it? As jdraw said, it's valid in T-SQL. You use it as a temp table in a stored procedure, like:

SELECT Blah INTO #AliasName...

SELECT Whatever FROM #AliasName

I don't know that it's valid in Access.
 
In what context did you see it? As jdraw said, it's valid in T-SQL. You use it as a temp table in a stored procedure, like:

SELECT Blah INTO #AliasName...

SELECT Whatever FROM #AliasName

I don't know that it's valid in Access.

From: http://stackoverflow.com/a/29700096

Access SQL does not support executing more than one SQL statement at a time, so the notion of a #temp table does not really apply. If you require a temporary table then you need to

create a "real" table,
do your work with it, and then
delete (drop) the table when you're done.

P'THHHHHETIC.
 
Gosh yes, it's true, Access isn't a full-blown server-based database engine. And a chisel isn't a jackhammer, and a Honda isn't a Ferrari. :rolleyes:
 
Ok. Thanks for all the responses. I wondered why it didn't work in Access 2007. I'll have to find another way to be able to insert missing numbers into a query that that converts a date field formatted as 'mm/dd/yyyy' to a 'm' formatted jobber to complete a 1 thru 12 sequence for exporting to my annual P&L sheet in Excel.
 

Users who are viewing this thread

Back
Top Bottom