none
Capitalisation of T-SQL text RRS feed

  • Question

  • Hello,

    I do all of my T-SQL coding inside Visual Studio using SQL Server Data Tools.

    I implement T-SQL in mixed upper and lower case instead of block capitals. In the past I have done this successfully; however, recently, Visual Studio has started changing my T-SQL that I type back to upper case.

    Does anyone know what setting controls this?

    Many thanks.

    Keith



    R K Howard

    Saturday, March 10, 2018 4:56 PM

Answers

  • Hello all,

    The problem seems to be fixed now, but I don't have 100% confidence that I can reproduce the problem and solution.

    I think the setting that achieved the result was:

    Properties > Project settings > Validate casing on identifiers

    I also closed and re-opened Visual Studio.

    If I get any further insight into this matter in the future, I will post it here.

    Thanks for your input.

    KR,

    Keith


    R K Howard

    Sunday, March 11, 2018 2:43 PM

All replies

  • Try Tools | Options | Text Editor | SQL Server Tools | Intellisense | Casing

    peter n roth - http://PNR1.com, Maybe some useful stuff

    Saturday, March 10, 2018 5:23 PM
  • Its here

    Change it to Lower Case


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Saturday, March 10, 2018 5:40 PM
  • Thanks Visakh16, but I would like to use mixed case.

    R K Howard

    Saturday, March 10, 2018 5:42 PM
  • Thanks Visakh16, but I would like to use mixed case.

    R K Howard

    What do you mean by Mixed case? can you elaborate? Do you mean same word itself multi case (proper case) ?

    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Saturday, March 10, 2018 6:43 PM
  • Hello.

    For example, on the 8th line below, Visual Studio keeps capitalising VARCHAR(MAX). I want it to appear like the Returns statement (line 5). It should be VarChar(Max). I don't know why Visual Studio recapitalises some text but not other text.

    Thanks.

    Keith

    Create Function [dbo].[G_F_Scalar_Table_GetFullContextAccountPhoneNumbersAndWebsiteAddressesHelper](
    @V_V_Scalar_Table_AccountPhoneNumbersAndWebsiteAddresses L_V_Scalar_Table_AccountPhoneNumbersAndWebsiteAddresses ReadOnly,
    @V_V_UniqueIdentifier_Account UniqueIdentifier,
    @V_V_Bit_PhoneNumbersAndWebsiteAddress Bit
    ) Returns VarChar (Max)
    AS
    BEGIN
    DECLARE @L_V_Scalar_VarChar_Return VARCHAR(MAX)
    Set @L_V_Scalar_VarChar_Return = 
    Stuff(
    Replace(
    (
    Select
    Char(10) + 
    Case 
    When @V_V_Bit_PhoneNumbersAndWebsiteAddress = 0
    Then N_N_VarChar_FullContextPhoneNumber 
    Else N_N_VarChar_FullContextWebsiteAddress
    End
    From @V_V_Scalar_Table_AccountPhoneNumbersAndWebsiteAddresses
    Where [N_N_UniqueIdentifier_Account] = @V_V_UniqueIdentifier_Account
    Order By [N_N_UniqueIdentifier_Account] Asc
    For XML Path('')
    ),
    '
',
    ''
    ),
    1,
    Len(Char(10)),
    ''
    )
    Return @L_V_Scalar_VarChar_Return
    End


    R K Howard

    Saturday, March 10, 2018 6:51 PM
  • https://docs.microsoft.com/en-us/sql/ssms/sql-server-management-studio-keyboard-shortcuts

    Make the selected text upper case CTRL+SHIFT+U CTRL+SHIFT+U


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance
    SQL Server Integration Services: Business Intelligence

    Sunday, March 11, 2018 7:49 AM
    Answerer
  • Hello.

    For example, on the 8th line below, Visual Studio keeps capitalising VARCHAR(MAX). I want it to appear like the Returns statement (line 5). It should be VarChar(Max). I don't know why Visual Studio recapitalises some text but not other text.

    Thanks.

    Keith

    Create Function [dbo].[G_F_Scalar_Table_GetFullContextAccountPhoneNumbersAndWebsiteAddressesHelper](
    @V_V_Scalar_Table_AccountPhoneNumbersAndWebsiteAddresses L_V_Scalar_Table_AccountPhoneNumbersAndWebsiteAddresses ReadOnly,
    @V_V_UniqueIdentifier_Account UniqueIdentifier,
    @V_V_Bit_PhoneNumbersAndWebsiteAddress Bit
    ) Returns VarChar (Max)
    AS
    BEGIN
    DECLARE @L_V_Scalar_VarChar_Return VARCHAR(MAX)
    Set @L_V_Scalar_VarChar_Return = 
    Stuff(
    Replace(
    (
    Select
    Char(10) + 
    Case 
    When @V_V_Bit_PhoneNumbersAndWebsiteAddress = 0
    Then N_N_VarChar_FullContextPhoneNumber 
    Else N_N_VarChar_FullContextWebsiteAddress
    End
    From @V_V_Scalar_Table_AccountPhoneNumbersAndWebsiteAddresses
    Where [N_N_UniqueIdentifier_Account] = @V_V_UniqueIdentifier_Account
    Order By [N_N_UniqueIdentifier_Account] Asc
    For XML Path('')
    ),
    '
',
    ''
    ),
    1,
    Len(Char(10)),
    ''
    )
    Return @L_V_Scalar_VarChar_Return
    End


    R K Howard

    Thats because of the same setting

    just keep it as lower case and manually change the ones you want to upper case

    or use shortcut key Ctrl + Shift + U to make the required ones upper case


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Sunday, March 11, 2018 8:04 AM
  • Hello all,

    The problem seems to be fixed now, but I don't have 100% confidence that I can reproduce the problem and solution.

    I think the setting that achieved the result was:

    Properties > Project settings > Validate casing on identifiers

    I also closed and re-opened Visual Studio.

    If I get any further insight into this matter in the future, I will post it here.

    Thanks for your input.

    KR,

    Keith


    R K Howard

    Sunday, March 11, 2018 2:43 PM
  • Hello all,

    The problem seems to be fixed now, but I don't have 100% confidence that I can reproduce the problem and solution.

    I think the setting that achieved the result was:

    Properties > Project settings > Validate casing on identifiers

    I also closed and re-opened Visual Studio.

    If I get any further insight into this matter in the future, I will post it here.

    Thanks for your input.

    KR,

    Keith


    R K Howard

    Hi Keith,

    Since you have fixed the issue, please close the thread by marking the useful reply as answer.

    Thanks for your contribution.

    Best Regards,

    Will


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 12, 2018 5:36 AM
    Moderator