Comments
Sort by recent activity
This is the contents of the file I was dealing with. If I paste the following into a new query window in Sql Mgt I get the same error as soon as I do the paste.
If I un-comment the comment in the WHERE clause and then paste the query it works just fine. Definatly has something to do with the comment.
If I mess up the formatting, then choose "Lay Out Sql" the formatting is correct, and then I get the error again.
If I delete the "--" while in Sql Mgt then all is well. Add the comment back by typing "--" and the error pops up again.
I had previously posted about how the missing CR/LF causes errors with comments.
Get me your email and I can send you the original file if you want it. DECLARE @DATEA DateTime ;
SET @DATEA = '7/01/2006'
-- DECLARE @DATEB DateTime ;
-- SET @DATEB = '8/01/2006'
USE SiteSecurity_Secure
SELECT dbo.OrganizationClasses.OrgClassCode,
o.OrgName,
COUNT(s.SearchID) AS CountOfSearchID
FROM dbo.BatchLog b WITH ( nolock )
INNER JOIN dbo.SearchLog s WITH ( nolock ) ON b.BatchID = s.BatchID
INNER JOIN dbo.SearchItems si WITH ( nolock ) ON s.SearchID = si.SearchID
INNER JOIN dbo.Organizations o WITH ( nolock ) ON b.OrgID = o.OrgID
INNER JOIN dbo.Organization_To_OrganizationClass WITH ( nolock ) ON o.OrgID = dbo.Organization_To_OrganizationClass.OrgID
INNER JOIN dbo.OrganizationClasses WITH ( nolock ) ON dbo.Organization_To_OrganizationClass.OrgClassID = dbo.OrganizationClasses.OrgClassID
WHERE s.SearchLogStatus <> 'E'
AND b.BatchStatus <> 'E'
AND ( si.ItemTypeID = 2 )
-- AND ( b.CreateDate < @DATEB )
AND ( b.CreateDate >= @DATEA )
GROUP BY
dbo.OrganizationClasses.OrgClassCode,
o.OrgName
ORDER BY
dbo.OrganizationClasses.OrgClassCode,
o.OrgName
/ comments
This is the contents of the file I was dealing with. If I paste the following into a new query window in Sql Mgt I get the same error as soon as I do the paste.
If I un-comment the comment in the W...
There's going to be another Beta? When? / comments
There's going to be another Beta? When?
I have received this error several times also. I suspect it has something to do with when there is a commented line.
For a while I was getting it all the time -- seems to be better today (And I have not rebooted).
Perhaps it was a specific file I was working on. I'll try to pay better attention. / comments
I have received this error several times also. I suspect it has something to do with when there is a commented line.
For a while I was getting it all the time -- seems to be better today (And I hav...
On a related note, if you use a custom alias and then use SqlPrompt to instert a field, it will use the automatic alias value instead of the custom alias.
In the example below, the table "Organization" is automatically aliased as "o", but I have chosen to use Org. SELECT * FROM Organization AS Org
If using SqlPrompt to instert a field in the WHERE clause, you will get (Note the aliased named in the WHERE clause): SELECT * FROM Organization AS Org WHERE o.[OrgName] = 'Test'
I'm not typing the query right now so I cannot test, but it may only occur if you leave out the 'AS' keyword when aliasing the table name. SELECT * FROM Organization Org WHERE o.[OrgName] = 'Test'
/ comments
On a related note, if you use a custom alias and then use SqlPrompt to instert a field, it will use the automatic alias value instead of the custom alias.
In the example below, the table "Organizat...
I feel like I was forced to agree. I want a recount. / comments
I feel like I was forced to agree. I want a recount.
I would suggest not making it the default. / comments
I would suggest not making it the default.
I like the 'Auto' alias feature, but I think a custom auto feature like PDinCA suggested. / comments
I like the 'Auto' alias feature, but I think a custom auto feature like PDinCA suggested.