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

Complex Queries (Alias'???)

I've noticed that the prompted fails to work on semi-complex queries.

At first I thought it didnt handle alias' in management studio 2005 so tried it in query analyser but alas it doesnt seem to be able to cope with semi-complex queries

For example in the following query:
SELECT DISTINCT	ST.ProdSubTypeId AS 'Id', 
					ST.ProdSubTypeDesc AS 'Name', 
					ST.DisplayOrder 
 
		FROM			tbProductSubTypes AS ST WITH (NOLOCK) 
 
		INNER JOIN		[vMasterProduct] AS MP WITH (NOLOCK) 
		ON 			ST.ProdSubTypeId = MP.ProdSubTypeId 
 
		WHERE		ST.ProdSubTypeDesc NOT IN ('TBA', 'N/A') 
		AND			WP.WebParentId = @WebParentId 
		AND
 
		ORDER BY		ST.DisplayOrder, ST.ProdSubTypeId

If I put a new and statement it intelisenses and produces me a list of available objects and it will intellisense through to the columns etc but if I try to do the same with an alias'd table I receive no help from SQL Prompt
tigermain
0

Comments

2 comments

  • dm
    Try removing the blank lines -- the parser did (does?) just handle the chunk of text around the cursor that is delimited by blank lines.
    dm
    0
  • tigermain
    OK that seems to work but at the same time sucks! I have seriously complex scripts (unlike this) and need line breaks to help identify segments of code. I cant go through and remove all the whitespace. That would not only be a chore but wouldnt help me in the long run
    tigermain
    0

Add comment

Please sign in to leave a comment.