Keywords next to character strings

Wyatt70Wyatt70 Posts: 50
edited July 9, 2007 9:05AM in SQL Prompt Previous Versions
I noticed that SQL Prompt handles keywords differenty when they are followed by a character string.

For example, let's say I have the following SQL code in a script:
exec (@vSQL);

If I use backspace to remove the space between "exec" and "(@vSQL);", SQL Prompt will convert "exec" to uppercase.

Now try this statement:
print 'in lab_missing';

If I use backspace to remove the space between "print" and "'in lab_missing';", SQL Prompt does NOT convert "print" to uppercase. I have to position my cursor after the "t" and press the spacebar in order to convert it to uppercase.

Is this by design?

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Wyatt,

    It seems to work differently in my case. I've got UPPERCASE enabled for reserved keywords, functions, and datdtypes, and I get my commands uppercased immediately, without backspacing or any other keys. I don't know why you're getting a different result.
  • Maybe one of my other settings is affecting this.

    Here are the settings I am using:
    Operating System: Windows XP SP2
    SQL Server Version: SQL Server 2005 SP2 (9.0.3054)

    Candidates Settings:
    All possible Completion Keys are checked: ("Enter", "Tab", "Spacebar", "Dot", "Comma", "Closing bracket", "Parenthesis")
    All possible Join Conditions are checked: ("Include matching column names", "Include matching data types")
    "Apply case-sensitive sort order" is NOT checked
    "Show objects for specified owner or schema" is checked
    All checkboxes in Other Objects are checked ("Include variables in the candidate list", "Include system objects in the candidate list")

    Style Settings:
    "Qualify object names" is checked
    "Qualify column names" is NOT checked
    "Surround with brackets" is NOT checked
    "Insert parentheses for built-in functions and data types" is checked
    "Reserved keywords" is set to "Force UPPERCASE"
    "Built-in functions" is set to "Force UPPERCASE"
    "Built-in data types" is set to "Force lowercase"

    Auto Insert Settings:
    "Enable TAB to expand columns after SELECT" is checked
    "Use new line for each column" is checked
    "Insert object definition on ALTER" is checked
    "Insert parameters for functions and stored procedures" is checked
    "Insert hints for data types" is checked
    In the "Automatic Closing Characters" section, the following are checked: ("Parenthesis", "Bracket" and "Single quotation mark")
    In the "Automatic Closing Characters" section, the following are NOT checked: ("Double quotation mark" and "Comment mark")
  • Can you make sure you have SQL Prompt 3.1 as I think we fixed a few issue like this betwenn 3.0 and 3.1
    Software Engineer
    Red Gate Software
  • This is my version number: 3.1.0.39.
  • Hi after a bit of further inverstiation I can repeat this and after asking the developer responsible for the engine it turns out that this is by design. The reason is that in the line
    print'in lab_missing'; 
    
    where the caret is after the t SQL Prompt thinks the caret is inside the string so doesn't do the keyword capitalisation. Not the best behaviour I know.

    Lionel
    Software Engineer
    Red Gate Software
  • I can live with it. At least I know it's not something wrong with my installation.
Sign In or Register to comment.