How can we help you today? How can we help you today?
amachanic

Activity overview

Latest activity by amachanic

To be honest, I wish you hadn't told me about the line breaks in identifiers... it's one of those things I'm going to pretend I never heard (*puts hands over eyes and ears*) [image] / comments
To be honest, I wish you hadn't told me about the line breaks in identifiers... it's one of those things I'm going to pretend I never heard (*puts hands over eyes and ears*)
0 votes
I can show you one version that doesn't work... First, the following does work: SELECT * FROM [HumanResources].[EmployeeAddress] ea JOIN [HumanResources].[Employee] e ON --*** JOIN [HumanResources].[EmployeeDepartmentHistory] edh ON e.[EmployeeID] = edh.[EmployeeID] ... type space before the *** comment and you get joins between "e" and "ea" ... one comment here -- I'd like to see the joins go BOTH ways if possible. I actually prefer doing <table I'm joining to>.col = <table I'm joining from>.col. A small semantic difference, but just the way I like to write my SQL. Now, a version that doesn't work... did you know that the ON clause can go in one of two places? SELECT * FROM [HumanResources].[EmployeeAddress] ea JOIN [HumanResources].[Employee] e JOIN [HumanResources].[EmployeeDepartmentHistory] edh ON e.[EmployeeID] = edh.[EmployeeID] ON --*** Hit space before the *** comment and you'll get a column list rather than JOIN candidates. The ONs here are nested in the same order as the JOINs, so you should get a list of candidates for the JOIN between "e" and "ea". (Note, I absolutely *hate* this syntax, but I see it from time to time so I suppose it should be supported) Now, another weird thing... What if I accidentally leave the ON below the JOINs? SELECT * FROM [HumanResources].[EmployeeAddress] ea JOIN [HumanResources].[Employee] e ON --*** JOIN [HumanResources].[EmployeeDepartmentHistory] edh ON e.[EmployeeID] = edh.[EmployeeID] ON Again, hit space before the *** comment and it's broken... Until I do something like: SELECT * FROM [HumanResources].[EmployeeAddress] ea JOIN [HumanResources].[Employee] e ON --*** JOIN [HumanResources].[EmployeeDepartmentHistory] edh ON e.[EmployeeID] = edh.[EmployeeID] ON x Some little bug in the parser, it seems? / comments
I can show you one version that doesn't work... First, the following does work: SELECT * FROM [HumanResources].[EmployeeAddress] ea JOIN [HumanResources].[Employee] e ON --*** JOIN [HumanResources]...
0 votes
Hi Bart, I'm not sure what the issue is. Can't you just grab the system view columns from the sys.all_columns view? What's keeping you from doing so? / comments
Hi Bart, I'm not sure what the issue is. Can't you just grab the system view columns from the sys.all_columns view? What's keeping you from doing so?
0 votes
Also, try assigning default values to one or both params and then do: SELECT dbo.rrr(def ... and the word "default" does not come up. / comments
Also, try assigning default values to one or both params and then do: SELECT dbo.rrr(def ... and the word "default" does not come up.
0 votes
Could be more helpful when calling UDFs
Create the following UDF: CREATE FUNCTION rrr (@id2 INT, @id int) RETURNS INT AS BEGIN RETURN (@id) END Now do: SELECT dbo.rrr( I see both params -- very useful -- but they're out of order. How ab...
2 followers 2 comments 0 votes