sql server programming:
[quoted text, click to view] > WHERE (((tblFeeTypes.Active))))
There is no BOOLEAN datatype in SQL Server. In other words, you can not say "WHERE someColumn" and have it implicitly understand that you meant "WHERE someColumn IS TRUE"... I think you meant: WHERE tblFeeTypes.Active = 1) (You don't need triple parens around a condition...)
[quoted text, click to view] > Thanks. I'm definitely floundering the boolean logic in T-SQL. So I can > test for say Active=1 in a WHERE clause, but can't return Active=1 as a > SELECT column, but I can return Active as a SELECT column, but not provide > it as a criteria in a WHERE clause.
I'm not sure why you think that returning a column in a SELECT statement and checking its value in a WHERE clause should have the same syntax? SELECT Active FROM table WHERE Active = 1 Why would you say: SELECT Active = 1 FROM table WHERE Active = 1 You've defeated the purpose of storing the data in the table, if you're going to override it anyway...
[quoted text, click to view] > Thanks, that was the problem. I do need the LEFT JOIN though because not > all of the records in Sub1 are in Sub2.
Roji's point is that you're not getting any data out of sub2 anyway, so who cares whether the rows are there are not.
Because Active = 1 is a valid expression in many languages. It evaluates to True. T-SQL doesn't believe in such things, as we old-timers know :) -- ---------------------------------------------------------------------------- ----------- Louis Davidson (drsql@hotmail.com) Compass Technology Management Pro SQL Server 2000 Database Design http://www.apress.com/book/bookDisplay.html?bID=266 Note: Please reply to the newsgroups only unless you are interested in consulting services. All other replies will be ignored :) [quoted text, click to view] "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message news:u15DNTerDHA.2404@TK2MSFTNGP12.phx.gbl... > > Thanks. I'm definitely floundering the boolean logic in T-SQL. So I can > > test for say Active=1 in a WHERE clause, but can't return Active=1 as a > > SELECT column, but I can return Active as a SELECT column, but not provide > > it as a criteria in a WHERE clause. > > I'm not sure why you think that returning a column in a SELECT statement and > checking its value in a WHERE clause should have the same syntax? > > SELECT Active FROM table WHERE Active = 1 > > Why would you say: > > SELECT Active = 1 FROM table WHERE Active = 1 > > You've defeated the purpose of storing the data in the table, if you're > going to override it anyway... > >
So, you're saying the OP wants SELECT TRUE FROM table WHERE Active = 1 ? I'm still not understanding the point... [quoted text, click to view] "Louis Davidson" <dr_dontspamme_sql@hotmail.com> wrote in message news:#ynZ#cfrDHA.2688@TK2MSFTNGP09.phx.gbl... > Because Active = 1 is a valid expression in many languages. It evaluates to > True. T-SQL doesn't believe in such things, as we old-timers know :)
You are right Roji, SQL Server doesn't have a Boolean datatype, so you have to explicitly compare the column with a value. -- Jacco Schalkwijk SQL Server MVP [quoted text, click to view] "Roji. P. Thomas" <someone@somewherel.com> wrote in message news:u55zhudrDHA.392@TK2MSFTNGP11.phx.gbl... > WHERE (((tblFeeTypes.Active)))) > This might be the line causing the > syntax error. I believe that you have to explicitly > check the value there. > > But one doubt. > When all you are doing is selecting Sub1.* > does having a LEFT Join makes sense? > > > HTH > roji > > > > > <paul@palmnospam.com> wrote in message > news:OWfpchdrDHA.3320@tk2msftngp13.phx.gbl... > > I'm having problems getting a particular query to work. It works ok > against > > JET / Access, but gives several syntax errors in the Query Analyzer. It's > > supposed to return results from two subqueries (Sub1 and Sub2) linked by > an > > outer join. > > > > SELECT Sub1.* FROM > > > > (SELECT tblFeeTypes.FeeTypeID, tblFeeTypes.ShowOnAllRolls, > > > > tblFeeTypes.ShowInAllCentres, tblFeeTypes.ServiceID, > > > > lnkFeeTypeFeeVariant.RollLetter, tblFeeVariants.FeeVariantID > > > > FROM tblFeeTypes > > > > INNER JOIN (tblFeeVariants INNER JOIN > > > > lnkFeeTypeFeeVariant ON tblFeeVariants.FeeVariantID = > > lnkFeeTypeFeeVariant.FeeVariantID) > > > > ON tblFeeTypes.FeeTypeID = lnkFeeTypeFeeVariant.FeeTypeID > > > > WHERE (((tblFeeTypes.Active)))) AS Sub1 > > > > LEFT JOIN > > > > (SELECT lnkFeeTypeToRoll.RollType, lnkFeeTypeToRoll.FeeTypeID > > > > FROM lnkFeeTypeToRoll > > > > WHERE (((lnkFeeTypeToRoll.RollType)=8))) AS Sub2 > > > > ON Sub1.FeeTypeID = Sub2.FeeTypeID > > > > WHERE ((((ShowOnAllRolls) Or (Sub2.FeeTypeID Is Not Null))) AND > > (((ServiceID=5) Or > > > > (ShowInAllCentres)))) > > > > ORDER BY Sub1.FeeVariantID, Sub1.FeeTypeName; > > > > > > > > Thanks, > > > > > > > > Paul > > > > > >
hi, the solution is simple: the SQL - Server doesn't understand (ShowInAllCentres), (tblFeeTypes.Active) and (ShowOnAllRolls) use (ShowInAllCentres<>0), (tblFeeTypes.Active<>0) and (ShowOnAllRolls<>0) instead, and everything is fine. In the WHERE-clause only boolean - EXPRESSIONS's are allowed (only JET/Access assumes, a boolean column could be a boolean expression itself). r.w. <paul@palmnospam.com> schrieb im Newsbeitrag news:OWfpchdrDHA.3320@tk2msftngp13.phx.gbl... [quoted text, click to view] > I'm having problems getting a particular query to work. It works ok against > JET / Access, but gives several syntax errors in the Query Analyzer. It's > supposed to return results from two subqueries (Sub1 and Sub2) linked by an > outer join. > > SELECT Sub1.* FROM > > (SELECT tblFeeTypes.FeeTypeID, tblFeeTypes.ShowOnAllRolls, > > tblFeeTypes.ShowInAllCentres, tblFeeTypes.ServiceID, > > lnkFeeTypeFeeVariant.RollLetter, tblFeeVariants.FeeVariantID > > FROM tblFeeTypes > > INNER JOIN (tblFeeVariants INNER JOIN > > lnkFeeTypeFeeVariant ON tblFeeVariants.FeeVariantID = > lnkFeeTypeFeeVariant.FeeVariantID) > > ON tblFeeTypes.FeeTypeID = lnkFeeTypeFeeVariant.FeeTypeID > > WHERE (((tblFeeTypes.Active)))) AS Sub1 > > LEFT JOIN > > (SELECT lnkFeeTypeToRoll.RollType, lnkFeeTypeToRoll.FeeTypeID > > FROM lnkFeeTypeToRoll > > WHERE (((lnkFeeTypeToRoll.RollType)=8))) AS Sub2 > > ON Sub1.FeeTypeID = Sub2.FeeTypeID > > WHERE ((((ShowOnAllRolls) Or (Sub2.FeeTypeID Is Not Null))) AND > (((ServiceID=5) Or > > (ShowInAllCentres)))) > > ORDER BY Sub1.FeeVariantID, Sub1.FeeTypeName; > > > > Thanks, > > > > Paul > >
One thing I can see immediately is that you need to name the derived table. You have (slightly reformatted for readability): [quoted text, click to view] > SELECT Sub1.* FROM
( .... [quoted text, click to view] > > (ShowInAllCentres)))
) That last part has to be something like: [quoted text, click to view] > SELECT Sub1.* FROM
( .... [quoted text, click to view] > > (ShowInAllCentres)))
) AS t You then refer to the result from this query with the table name "t". -- Tibor Karaszi, SQL Server MVP Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver [quoted text, click to view] <paul@palmnospam.com> wrote in message news:OWfpchdrDHA.3320@tk2msftngp13.phx.gbl... > I'm having problems getting a particular query to work. It works ok against > JET / Access, but gives several syntax errors in the Query Analyzer. It's > supposed to return results from two subqueries (Sub1 and Sub2) linked by an > outer join. > > SELECT Sub1.* FROM > > (SELECT tblFeeTypes.FeeTypeID, tblFeeTypes.ShowOnAllRolls, > > tblFeeTypes.ShowInAllCentres, tblFeeTypes.ServiceID, > > lnkFeeTypeFeeVariant.RollLetter, tblFeeVariants.FeeVariantID > > FROM tblFeeTypes > > INNER JOIN (tblFeeVariants INNER JOIN > > lnkFeeTypeFeeVariant ON tblFeeVariants.FeeVariantID = > lnkFeeTypeFeeVariant.FeeVariantID) > > ON tblFeeTypes.FeeTypeID = lnkFeeTypeFeeVariant.FeeTypeID > > WHERE (((tblFeeTypes.Active)))) AS Sub1 > > LEFT JOIN > > (SELECT lnkFeeTypeToRoll.RollType, lnkFeeTypeToRoll.FeeTypeID > > FROM lnkFeeTypeToRoll > > WHERE (((lnkFeeTypeToRoll.RollType)=8))) AS Sub2 > > ON Sub1.FeeTypeID = Sub2.FeeTypeID > > WHERE ((((ShowOnAllRolls) Or (Sub2.FeeTypeID Is Not Null))) AND > (((ServiceID=5) Or > > (ShowInAllCentres)))) > > ORDER BY Sub1.FeeVariantID, Sub1.FeeTypeName; > > > > Thanks, > > > > Paul > >
Oh, yeah, that is kindof strange. I misunderstood your point. Sorry :) -- ---------------------------------------------------------------------------- ----------- Louis Davidson (drsql@hotmail.com) Compass Technology Management Pro SQL Server 2000 Database Design http://www.apress.com/book/bookDisplay.html?bID=266 Note: Please reply to the newsgroups only unless you are interested in consulting services. All other replies will be ignored :) [quoted text, click to view] "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message news:%23i$ATGgrDHA.4080@tk2msftngp13.phx.gbl... > So, you're saying the OP wants > > SELECT TRUE FROM table WHERE Active = 1 > > ? I'm still not understanding the point... > > > "Louis Davidson" <dr_dontspamme_sql@hotmail.com> wrote in message > news:#ynZ#cfrDHA.2688@TK2MSFTNGP09.phx.gbl... > > Because Active = 1 is a valid expression in many languages. It evaluates > to > > True. T-SQL doesn't believe in such things, as we old-timers know :) > >
WHERE (((tblFeeTypes.Active)))) This might be the line causing the syntax error. I believe that you have to explicitly check the value there. But one doubt. When all you are doing is selecting Sub1.* does having a LEFT Join makes sense? HTH roji [quoted text, click to view] <paul@palmnospam.com> wrote in message news:OWfpchdrDHA.3320@tk2msftngp13.phx.gbl... > I'm having problems getting a particular query to work. It works ok against > JET / Access, but gives several syntax errors in the Query Analyzer. It's > supposed to return results from two subqueries (Sub1 and Sub2) linked by an > outer join. > > SELECT Sub1.* FROM > > (SELECT tblFeeTypes.FeeTypeID, tblFeeTypes.ShowOnAllRolls, > > tblFeeTypes.ShowInAllCentres, tblFeeTypes.ServiceID, > > lnkFeeTypeFeeVariant.RollLetter, tblFeeVariants.FeeVariantID > > FROM tblFeeTypes > > INNER JOIN (tblFeeVariants INNER JOIN > > lnkFeeTypeFeeVariant ON tblFeeVariants.FeeVariantID = > lnkFeeTypeFeeVariant.FeeVariantID) > > ON tblFeeTypes.FeeTypeID = lnkFeeTypeFeeVariant.FeeTypeID > > WHERE (((tblFeeTypes.Active)))) AS Sub1 > > LEFT JOIN > > (SELECT lnkFeeTypeToRoll.RollType, lnkFeeTypeToRoll.FeeTypeID > > FROM lnkFeeTypeToRoll > > WHERE (((lnkFeeTypeToRoll.RollType)=8))) AS Sub2 > > ON Sub1.FeeTypeID = Sub2.FeeTypeID > > WHERE ((((ShowOnAllRolls) Or (Sub2.FeeTypeID Is Not Null))) AND > (((ServiceID=5) Or > > (ShowInAllCentres)))) > > ORDER BY Sub1.FeeVariantID, Sub1.FeeTypeName; > > > > Thanks, > > > > Paul > >
I'm having problems getting a particular query to work. It works ok against JET / Access, but gives several syntax errors in the Query Analyzer. It's supposed to return results from two subqueries (Sub1 and Sub2) linked by an outer join. SELECT Sub1.* FROM (SELECT tblFeeTypes.FeeTypeID, tblFeeTypes.ShowOnAllRolls, tblFeeTypes.ShowInAllCentres, tblFeeTypes.ServiceID, lnkFeeTypeFeeVariant.RollLetter, tblFeeVariants.FeeVariantID FROM tblFeeTypes INNER JOIN (tblFeeVariants INNER JOIN lnkFeeTypeFeeVariant ON tblFeeVariants.FeeVariantID = lnkFeeTypeFeeVariant.FeeVariantID) ON tblFeeTypes.FeeTypeID = lnkFeeTypeFeeVariant.FeeTypeID WHERE (((tblFeeTypes.Active)))) AS Sub1 LEFT JOIN (SELECT lnkFeeTypeToRoll.RollType, lnkFeeTypeToRoll.FeeTypeID FROM lnkFeeTypeToRoll WHERE (((lnkFeeTypeToRoll.RollType)=8))) AS Sub2 ON Sub1.FeeTypeID = Sub2.FeeTypeID WHERE ((((ShowOnAllRolls) Or (Sub2.FeeTypeID Is Not Null))) AND (((ServiceID=5) Or (ShowInAllCentres)))) ORDER BY Sub1.FeeVariantID, Sub1.FeeTypeName; Thanks, Paul
[quoted text, click to view] > It would just make things a little tidier if there was an > assumed equivalency between the bit data type > and booleans.
Uh oh. This might be a Celko trigger! CREATE TRIGGER WakeCelko ON microsoft.public.* FOR INSERT /* post to group */ AS IF (CHARINDEX('bit', post) > 0 AND CHARINDEX('boolean', post) > 0) OR (CHARINDEX('row', post) > 0) OR (CHARINDEX('column', post) > 0) OR (CHARINDEX('@tablename', post) > 0) OR (CHARINDEX('rank', post) > 0) BEGIN EXEC dbo.WakeCelkoAndPrepareStick() END :-))))
Thanks for the replies, they were spot on!
Thanks. I'm definitely floundering the boolean logic in T-SQL. So I can test for say Active=1 in a WHERE clause, but can't return Active=1 as a SELECT column, but I can return Active as a SELECT column, but not provide it as a criteria in a WHERE clause. [quoted text, click to view] "Warnat" <warnat@nospam.com> wrote in message news:OZCECvdrDHA.2568@TK2MSFTNGP09.phx.gbl... > hi, > > the solution is simple: > the SQL - Server doesn't understand > (ShowInAllCentres), (tblFeeTypes.Active) and (ShowOnAllRolls) > use > (ShowInAllCentres<>0), (tblFeeTypes.Active<>0) and (ShowOnAllRolls<>0) > instead, and everything is fine. > In the WHERE-clause only boolean - EXPRESSIONS's are allowed (only > JET/Access > assumes, a boolean column could be a boolean expression itself). > > r.w. > > > <paul@palmnospam.com> schrieb im Newsbeitrag > news:OWfpchdrDHA.3320@tk2msftngp13.phx.gbl... > > I'm having problems getting a particular query to work. It works ok > against > > JET / Access, but gives several syntax errors in the Query Analyzer. It's > > supposed to return results from two subqueries (Sub1 and Sub2) linked by > an > > outer join. > > > > SELECT Sub1.* FROM > > > > (SELECT tblFeeTypes.FeeTypeID, tblFeeTypes.ShowOnAllRolls, > > > > tblFeeTypes.ShowInAllCentres, tblFeeTypes.ServiceID, > > > > lnkFeeTypeFeeVariant.RollLetter, tblFeeVariants.FeeVariantID > > > > FROM tblFeeTypes > > > > INNER JOIN (tblFeeVariants INNER JOIN > > > > lnkFeeTypeFeeVariant ON tblFeeVariants.FeeVariantID = > > lnkFeeTypeFeeVariant.FeeVariantID) > > > > ON tblFeeTypes.FeeTypeID = lnkFeeTypeFeeVariant.FeeTypeID > > > > WHERE (((tblFeeTypes.Active)))) AS Sub1 > > > > LEFT JOIN > > > > (SELECT lnkFeeTypeToRoll.RollType, lnkFeeTypeToRoll.FeeTypeID > > > > FROM lnkFeeTypeToRoll > > > > WHERE (((lnkFeeTypeToRoll.RollType)=8))) AS Sub2 > > > > ON Sub1.FeeTypeID = Sub2.FeeTypeID > > > > WHERE ((((ShowOnAllRolls) Or (Sub2.FeeTypeID Is Not Null))) AND > > (((ServiceID=5) Or > > > > (ShowInAllCentres)))) > > > > ORDER BY Sub1.FeeVariantID, Sub1.FeeTypeName; > > > > > > > > Thanks, > > > > > > > > Paul > > > > > >
Hi Roji, Thanks, that was the problem. I do need the LEFT JOIN though because not all of the records in Sub1 are in Sub2. Kind Regards, Paul [quoted text, click to view] "Roji. P. Thomas" <someone@somewherel.com> wrote in message news:u55zhudrDHA.392@TK2MSFTNGP11.phx.gbl... > WHERE (((tblFeeTypes.Active)))) > This might be the line causing the > syntax error. I believe that you have to explicitly > check the value there. > > But one doubt. > When all you are doing is selecting Sub1.* > does having a LEFT Join makes sense? > > > HTH > roji > > > > > <paul@palmnospam.com> wrote in message > news:OWfpchdrDHA.3320@tk2msftngp13.phx.gbl... > > I'm having problems getting a particular query to work. It works ok > against > > JET / Access, but gives several syntax errors in the Query Analyzer. It's > > supposed to return results from two subqueries (Sub1 and Sub2) linked by > an > > outer join. > > > > SELECT Sub1.* FROM > > > > (SELECT tblFeeTypes.FeeTypeID, tblFeeTypes.ShowOnAllRolls, > > > > tblFeeTypes.ShowInAllCentres, tblFeeTypes.ServiceID, > > > > lnkFeeTypeFeeVariant.RollLetter, tblFeeVariants.FeeVariantID > > > > FROM tblFeeTypes > > > > INNER JOIN (tblFeeVariants INNER JOIN > > > > lnkFeeTypeFeeVariant ON tblFeeVariants.FeeVariantID = > > lnkFeeTypeFeeVariant.FeeVariantID) > > > > ON tblFeeTypes.FeeTypeID = lnkFeeTypeFeeVariant.FeeTypeID > > > > WHERE (((tblFeeTypes.Active)))) AS Sub1 > > > > LEFT JOIN > > > > (SELECT lnkFeeTypeToRoll.RollType, lnkFeeTypeToRoll.FeeTypeID > > > > FROM lnkFeeTypeToRoll > > > > WHERE (((lnkFeeTypeToRoll.RollType)=8))) AS Sub2 > > > > ON Sub1.FeeTypeID = Sub2.FeeTypeID > > > > WHERE ((((ShowOnAllRolls) Or (Sub2.FeeTypeID Is Not Null))) AND > > (((ServiceID=5) Or > > > > (ShowInAllCentres)))) > > > > ORDER BY Sub1.FeeVariantID, Sub1.FeeTypeName; > > > > > > > > Thanks, > > > > > > > > Paul > > > > > >
Hi Paul, Thanks for your post. It seems that you have found the problem in your query. I'm including some supplemental information for your reference. In Access, we are able to apply the ANSI-92 SQL query mode to a query via setting the SQL Server Compatible Syntax option, which is compatible with Microsoft SQL Server. To set the SQL Server Compatible Syntax option in Access, please view these steps. Tools-->Options-->Tables/Queries tab-->SQL Server Compatible Syntax option. Please feel free to post in the group if this solves your problem or if you would like further assistance. Regards, Michael Shao Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
LOL! But surely you meant to say "record" and "field" instead of "row" and "column"? :-) -- Tibor Karaszi, SQL Server MVP Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver [quoted text, click to view] "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message news:uv9pPZlrDHA.2364@TK2MSFTNGP09.phx.gbl... > > It would just make things a little tidier if there was an > > assumed equivalency between the bit data type > > and booleans. > > Uh oh. This might be a Celko trigger! > > > CREATE TRIGGER WakeCelko > ON microsoft.public.* > FOR INSERT /* post to group */ > AS > IF (CHARINDEX('bit', post) > 0 AND CHARINDEX('boolean', post) > 0) > OR (CHARINDEX('row', post) > 0) > OR (CHARINDEX('column', post) > 0) > OR (CHARINDEX('@tablename', post) > 0) > OR (CHARINDEX('rank', post) > 0) > BEGIN > EXEC dbo.WakeCelkoAndPrepareStick() > END > > > :-)))) > >
[quoted text, click to view] > It would just make things a > little tidier if there was an assumed equivalency between the bit data type > and booleans.
But what about the 3:rd truth state? "Is 32 = NULL?", which evaluates to UNKNOWN. So you now have a datatype which should accept TRUE, FALSE, UNKNOWN, and of course all datatypes should accept NULL. This complexity was what made ANSI not include a Boolean datatype in SQL-92. They did in SQL:1999, and ignored the difference there between UNKNOWN and NULL. See old posts from Joe Celko on the topic. -- Tibor Karaszi, SQL Server MVP Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver [quoted text, click to view] <paul@palmnospam.com> wrote in message news:uCB1%23SjrDHA.2004@TK2MSFTNGP10.phx.gbl... > Yes, well I guess that's the problem. To me that doesn't look strange at > all, in fact I do it quite a lot in Access. It would just make things a > little tidier if there was an assumed equivalency between the bit data type > and booleans. > > Kind Regards, > > Paul > > "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message > news:%23i$ATGgrDHA.4080@tk2msftngp13.phx.gbl... > > So, you're saying the OP wants > > > > SELECT TRUE FROM table WHERE Active = 1 > > > > ? I'm still not understanding the point... > > > > > > "Louis Davidson" <dr_dontspamme_sql@hotmail.com> wrote in message > > news:#ynZ#cfrDHA.2688@TK2MSFTNGP09.phx.gbl... > > > Because Active = 1 is a valid expression in many languages. It > evaluates > > to > > > True. T-SQL doesn't believe in such things, as we old-timers know :) > > > > > >
Yes, well I guess that's the problem. To me that doesn't look strange at all, in fact I do it quite a lot in Access. It would just make things a little tidier if there was an assumed equivalency between the bit data type and booleans. Kind Regards, Paul [quoted text, click to view] "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message news:%23i$ATGgrDHA.4080@tk2msftngp13.phx.gbl... > So, you're saying the OP wants > > SELECT TRUE FROM table WHERE Active = 1 > > ? I'm still not understanding the point... > > > "Louis Davidson" <dr_dontspamme_sql@hotmail.com> wrote in message > news:#ynZ#cfrDHA.2688@TK2MSFTNGP09.phx.gbl... > > Because Active = 1 is a valid expression in many languages. It evaluates > to > > True. T-SQL doesn't believe in such things, as we old-timers know :) > >
No, but as part of the criteria for rows selected from Sub1, I'm checking for the presence of a value in Sub2. Without the LEFT JOIN no values in Sub1 that aren't in Sub2 would make it through. Omitting Sub2 altogether would allow all values through in Sub1, but under certain conditions I don't want values in Sub1 that aren't in Sub2 to be returned. WHERE ((((ShowOnAllRolls<>0) Or (Sub2.FeeTypeID Is Not Null))) AND (((Sub1.ServiceID=5) Or (Sub1.ShowInAllCentres<>0)))) [quoted text, click to view] "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message news:O5dBjTerDHA.512@tk2msftngp13.phx.gbl... > > Thanks, that was the problem. I do need the LEFT JOIN though because not > > all of the records in Sub1 are in Sub2. > > Roji's point is that you're not getting any data out of sub2 anyway, so who > cares whether the rows are there are not. > >
I cannot get those out of my head lately. I am in some training for a piece of call center software and every time she says field and record I want to scream "NO, NO, row and column!" -- ---------------------------------------------------------------------------- ----------- Louis Davidson (drsql@hotmail.com) Compass Technology Management Pro SQL Server 2000 Database Design http://www.apress.com/book/bookDisplay.html?bID=266 Note: Please reply to the newsgroups only unless you are interested in consulting services. All other replies will be ignored :) "Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@cornerstone.se> [quoted text, click to view] wrote in message news:uS7b5FnrDHA.640@tk2msftngp13.phx.gbl... > LOL! > > But surely you meant to say "record" and "field" instead of "row" and "column"? :-) > > -- > Tibor Karaszi, SQL Server MVP > Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver > > > "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message > news:uv9pPZlrDHA.2364@TK2MSFTNGP09.phx.gbl... > > > It would just make things a little tidier if there was an > > > assumed equivalency between the bit data type > > > and booleans. > > > > Uh oh. This might be a Celko trigger! > > > > > > CREATE TRIGGER WakeCelko > > ON microsoft.public.* > > FOR INSERT /* post to group */ > > AS > > IF (CHARINDEX('bit', post) > 0 AND CHARINDEX('boolean', post) > 0) > > OR (CHARINDEX('row', post) > 0) > > OR (CHARINDEX('column', post) > 0) > > OR (CHARINDEX('@tablename', post) > 0) > > OR (CHARINDEX('rank', post) > 0) > > BEGIN > > EXEC dbo.WakeCelkoAndPrepareStick() > > END > > > > > > :-)))) > > > > > >
Hi Michael, Thanks for the reply. I have tried ticking this before, but my queries were still not SQL Server compatible. For instance, with this ticked (Access 2003), a simple delete query in the designer still comes out as: DELETE tblDDRun.* FROM tblDDRun; And a select query: SELECT tblContacts.ContactID, Accounts<>0 AS Test FROM tblContacts; Also works, both of which aren't ANSI-92 compliant? Kind Regards, Paul [quoted text, click to view] "Michael Shao [MSFT]" <v-yshao@online.microsoft.com> wrote in message news:TktUHIlrDHA.1728@cpmsftngxa06.phx.gbl... > Hi Paul, > > Thanks for your post. It seems that you have found the problem in your > query. I'm including some supplemental information for your reference. In > Access, we are able to apply the ANSI-92 SQL query mode to a query via > setting the SQL Server Compatible Syntax option, which is compatible with > Microsoft SQL Server. > > To set the SQL Server Compatible Syntax option in Access, please view these > steps. > Tools-->Options-->Tables/Queries tab-->SQL Server Compatible Syntax option. > > Please feel free to post in the group if this solves your problem or if you > would like further assistance. > > Regards, > > Michael Shao > Microsoft Online Partner Support > Get Secure! - www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights. >
Hi Paul, Thanks for your feedback. I apologize for confusion. I mean that selecting to enable ANSI-92 SQL query mode so we can run queries using ANSI-92 SQL syntax. This mode is compatible with Microsoft SQL Server. Also, do the community members answers address your problem? please feel free to let me know if you need further assistance. Thanks for using MSDN newsgroup. Regards, Michael Shao Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Hi Michael, Ok, got it. That's pretty cool, it will save me some time testing that I have correctly arrived at a syntax that will work with both Access and SQL (a very elusive goal). Is there a way to instruct the JETOLEDB driver to also do this, or is it some preprocessing unique to Access? Just one small observation; if I make any modifications to my query in design view, it converts the entire query back to jet format. It would be great if the designer could also operate in ANSI 92 syntax. Yes, the community people have been very helpful in answering my question, they'll do you out of a job! Kind Regards, Paul [quoted text, click to view] "Michael Shao [MSFT]" <v-yshao@online.microsoft.com> wrote in message news:UUcfTu0rDHA.3444@cpmsftngxa07.phx.gbl... > Hi Paul, > > Thanks for your feedback. I apologize for confusion. I mean that selecting > to enable ANSI-92 SQL query mode so we can run queries using ANSI-92 SQL > syntax. This mode is compatible with Microsoft SQL Server. > > Also, do the community members answers address your problem? please feel > free to let me know if you need further assistance. > > Thanks for using MSDN newsgroup. > > Regards, > > Michael Shao > Microsoft Online Partner Support > Get Secure! - www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights. >
Hi Paul, Thanks for your feedback. Based on my experience, it seems that it is impossible to translate the SQL statements automatically using Jet engine or Access. We have to do the translation of SQL statements from Access to SQL Server manually. If you have any problems regarding translation in future, please feel free to post in the newsgroup and the community members and I will be glad to work with you. Thanks for using MSDN newsgroup. Regards, Michael Shao Microsoft Online Partner Support Get Secure! ¨C www.microsoft.com/security This posting is provided ¡°as is¡± with no warranties and confers no rights.
Don't see what you're looking for? Try a search.
|