Square brackets in T-SQL

Could someone please explain the difference between, these two commands:
SELECT * FROM [DB_NAME].[SCHEMA_NAME].[TABLE_NAME]
SELECT * FROM [DB_NAME.SCHEMA_NAME.TABLE_NAME]
Thanks,
Abhi

Please also take a look the article below:
Delimited Identifiers (Database Engine):
http://technet.microsoft.com/en-us/library/ms176027.aspx
Regards,
Elvis Long
TechNet Community Support

Similar Messages

  • Sql Query to replace the square bracket and the whole text inside with a single charecter

    Hi All,
    I  have a question.
    I am using Sql Server 2012.
    I have a  situation where i need to replace the entire text and the square bracket with a single charecter.
    Eg:-> 
    I have atext    san[123456dd]text
    i just wanted to replace all teh text inside the sqaure bracket to another charecter say 'X' 
    My end result should be sanXtext.
    Could anyone help me regarding this?
    Samproo

    Prashanth ,
    Thanks 
    It works if i have a single square bracket like 
    'san[123456dd]text'but presently i do have multiple square brackets like'san[123456dd]text[898989dd]note'I wanted to have teh result as 'sanXtextXnote'
    Samproo

  • Replace square brackets in SQL queries against ODBC

    We use PowerPivot to access an ODBC provider. PowerPivot generates queries with square brackets, which is not ANSI compliant and incompatible with this ODBC provider. In Office 2010, we had a workaround by modifying this file:
    C:\Program Files\Microsoft Analysis Services\AS OLEDB\110\sql2000.xsl
    and replace the '[' and ']' with double quotes.
    !-- SQL Server 2000 pluggable cartridge -->
    <!-- Area of STANDARD parametrizations: these are externally passed -->
    <xsl:param name="in_CanUseParams">yes</xsl:param>
    <xsl:param name="in_IdentStartQuotingCharacter">[</xsl:param>
    <xsl:param name="in_IdentEndQuotingCharacter">]</xsl:param>
    However, this workaround does not seem to work after we upgraded to Office 2013. PowerPivot doesn't appear to read this cartridge file anymore. We are familiar with the option to manually write queries to bypass this issue, but we still like to use the generated
    queries. Is there another way to replace the square brackets?

    I think you could do this:
    Code Snippet
    SELECT
    OUTSIDE
    .OUTSIDE_SALES,
    INSIDE.INSIDE_SALES,
    CUST.CUST_NAME,
    SOE.CUSTOMER_NO,
    SOE.SALE_ORDER_NO,
    SOE.INVOICED_DATE,
    PICKUP.PICKUP,
    (SOE.SALES_AMT/100) AS SALES,
    (SOE.COST_GOODS_SOLD/100) AS COGS,
    (SOE.SALES_AMT/100) - (SOE.COST_GOODS_SOLD/100) AS MARGIN,
    COUNT(TRACKING.PALLET_ID)
    FROM
    SOE_HEADER SOE
    INNER JOIN CUST_NAME CUST
    ON SOE.CUSTOMER_NO = CUST.CUSTOMER_NO
    INNER JOIN INSIDE_SALES INSIDE
    ON SOE.INSIDE_ROUTE = INSIDE.INSIDE_ROUTE
    INNER JOIN OUTSIDE_SALES OUTSIDE
    ON SOE.SALESMAN_NO = OUTSIDE.SALESMAN_NO
    INNER JOIN PICKUP PICKUP
    ON SOE.TYPE_OF_FRGHT = PICKUP.TYPE_OF_FRGHT
    INNER JOIN PALLET_SALES_ORD SALES
    ON SOE.SALE_ORDER_NO = SALES.SALE_ORDER_NO
    INNER JOIN PALLET_TRACKING TRACKING
    ON SALES.PALLET_ID = TRACKING.PALLET_ID
    WHERE
    SOE.TYPE_OF_ORDER = '00'
    AND SOE.ORDERS_STATUS = '06'
    AND SOE.DATE_OF_ORDER > 20080101
    AND SOE.TYPE_OF_FRGHT IN ('06','08','10','13','14')
    AND SOE.CUSTOMER_NO <> '1000027000'
    AND SOE.CUSTOMER_NO <> '1000039000'
    AND SOE.CUSTOMER_NO <> '1014869000'
    AND SOE.CUSTOMER_NO <> '1014869001'
    AND SOE.CUSTOMER_NO <> '1014869002'
    AND SOE.CUSTOMER_NO <> '1014869003'
    AND SOE.CUSTOMER_NO <> '1014889000'
    AND SOE.CUSTOMER_NO <> '1014890000'
    AND SOE.CUSTOMER_NO <> '4400000000'
    AND SOE.CUSTOMER_NO <> '4499998000'
    AND SOE.CUSTOMER_NO <> '4500012000'
    AND SOE.CUSTOMER_NO <> '4500018000'
    AND SOE.CUSTOMER_NO <> '6900002000'
    AND CUST.CUST_NAME NOT LIKE '%PETCO%'
    GROUP BY
    OUTSIDE
    .OUTSIDE_SALES,
    INSIDE.INSIDE_SALES,
    CUST.CUST_NAME,
    SOE.CUSTOMER_NO,
    SOE.SALE_ORDER_NO,
    SOE.INVOICED_DATE,
    PICKUP.PICKUP,
    (SOE.SALES_AMT/100),
    (SOE.COST_GOODS_SOLD/100),
    (SOE.SALES_AMT/100) - (SOE.COST_GOODS_SOLD/100)
    ORDER BY
    OUTSIDE
    .OUTSIDE_SALES,
    CUST.CUST_NAME,
    SOE.INVOICED_DATE,
    SOE.TYPE_OF_FRGHT
    Another option would be to encapsulate the second query in a scalar UDF (if using SQL2k or greater) which would get the count for each sales order and then just return this in your select statement.
    HTH!

  • SQL Server 2012 sqlcmd: Unexplained behaviour returning output containing square brackets []

    From a SQL Server 2012 installation, executing either:
    sqlcmd /E -S <ServerName> -Q "PRINT '[A], [B], [C]'" or
    sqlcmd /E -S <ServerName> -Q "PRINT CHAR(91) + 'A], [B], [C]'"
    gives:-
    , [B], [C]
    wheras for 2005, 2008 or 2008R2, gives the expected result of:-
    [A], [B], [C]
    I haven't been able to find an explanation or way to force the correct result from 2012 sqlcmd.  It appears to me that 2012 is interpreting a lefthand square bracket as the first character on a line as some sort of token delimiter
    or similar.
    Can anyone shed some light on this or is it an issue for Connect?  This is just an example of the problem, I am not actually trying to print [A], [B], [C]! :) -  we are experiencing data loss/corruption on outputs from stored procedures where
    the leftmost character is [.
    Note that 2012 sqlcmd expects a closing ] on the line, otherwise the output gets returned like this for:-
    sqlcmd /E -S <ServerName> -Q "PRINT '[A, [B], [C'"
    [Microsoft][SQL Server Native Client 11.0][SQL Server][A, [B], [C
    Thanks

    It must be tokenizing the [A] for some reason.
    So, its not a [A] which is a problem its "[" as the first character of the output.
    I agree that it's an issue with SQLCMD in SQL 2012. If you capture profiler, command is passed correctly to SQL engine.  It seems like when output stream comes out, SQLCMD looks for "[" as first character and chops off content till next "]"
    If there is not matching closing "]" it shows the text with additional message.
    Workaround - Just add additional space prior to square bracket and it works fine.
    Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog |
    Team Blog | @Twitter
    Author: SQL Server 2012 AlwaysOn -
    Paperback, Kindle

  • Round and square brackets in regexp

    Hello,
    Can someone please explain to me what is the difference between:
    SELECT REGEXP_INSTR('aoeeeeo','(i|e)o') position FROM dual;
    and
    SELECT REGEXP_INSTR('aoeeeeo','[ie]o') position FROM dual;
    I mean, what is the main difference between round brackets with the alternation operator and square brackets in regular expressions?
    Thank you very much,

    It will perhaps be clearer if you look at it with more than just single characters...
    SQL> select regexp_replace('this is fred and his test string', '(is|and)','XXX') from dual;
    REGEXP_REPLACE('THISISFREDANDHISTES
    thXXX XXX fred XXX hXXX test string
    SQL> select regexp_replace('this is fred and his test string', '[isand]','XXX') from dual;
    REGEXP_REPLACE('THISISFREDANDHISTESTSTRING','[ISAND]','XXX')
    thXXXXXX XXXXXX freXXX XXXXXXXXX hXXXXXX teXXXt XXXtrXXXXXXg
    SQL>The round brackets allow you to specify whole strings whereas the square brackets allow you to specify sets of individual characters.
    Therefore in my first example it looks for IS or AND and replaces those.
    In the second example it looks for any occurence of the characters I,S,A,N,D and replaces those.

  • To see if a file has balanced curly braces, square brackets

    I am writing this class (along with other files that are in a package) to insert characters in a linkedlist and to see if the curly braces, square brackets and parentheses are balanced. For example something like this( I need to have line numbers also );
    1. This file is balanced with curly braces, square brackets
    2. and parentheses: {}, [] and (). These
    3. characters are not required to balance inside
    4. quoted strings. E.g., "){[[]".
    Input is balanced.
    I am not doing it right and that is where I need help or a way to lead me to a solution. I am going crazy, I am losing it....any good idea will help.import java.io.*;
    import java.util.StringTokenizer;
    class balance
      public static void main(String arg[])
         Queue word = new Queue();
          int index = 0;
         LinkedList itr = new LinkedList();
         LinkedList size = new LinkedList();
            try
                FileReader fr = new FileReader (arg[0]);
                BufferedReader inFile = new BufferedReader(fr);
                String line = inFile.readLine();
                 while(line != null)
                    line = inFile.readLine();
                       while(size >= line.length() && line.charAt(index) != ' ')
                         Sentence.insert (new Character(line.charAt(index)));
                         index++;
                       while(!Sentence.empty( ))
                                while( itr != null )&& itr.equals( "{" ) || itr.equals( "}"))
                       System.out.print (((Character)Sentence.remove()).charValue());
                       System.out.print ("  ");
                        index++;
                inFile.close();
           catch ( Exception e )
            {  System.out.println( e );  }
          System.exit(0);
    }

    A fairly easy way is to have one counter variable per bracket-set you want to test for balance and count this vairable up each time you meet an opening bracket (outside a qouted string) and down each time you meet a closing bracket (also outside a qouted string)...
    If these counters does not finish with having their initial values (eg. zero) the one set not balanced is the one whose counter variable is not zero (positive for too many opening brackets, negative for too many closing brackets)
    eg.
    int countSquareBrackets = 0;
    int countCurlyBrackets = 0;
    int countParenthesis = 0;
    if (/*not in string*/)
    switch (line.charAt(index)) {
    case '[': ++countSquareBrackets; break;
    case ']': --countSquareBrackets; break;
    case '{': ++countCurlyBrackets; break;
    case '}': --countCurlyBrackets; break;
    case '(': ++countParenthesis; break;
    case ')': --countParenthesis; break;
    Hope it leads you closer to a solution,
    chrh

  • Opening an excel file from a button. square brackets in filename

    Internet explorer 6. Apex 3.1
    When I open an excel file (via a button) , it has the filename as follows:
    production_report[1].csv
    The prompt to save or open has the name as production_report.csv
    This prevents people saving the opened file as square brackets are not allowed in the file name.
    Is this an apex issue (ie a problem with the way I specify the filename) or a browser issue, and is there a solution?
    I am passing the filename in to my excel download page using the items/values settings.
    eg
    ITEM P12_FILENAME
    ITEM VALUE production_report.csv

    Yes, It works on firefox. It is only an issue with Internet Explorer.
    However our web based application has to use IE and therefore when it calls apex it is in an IE browser.
    I am really just producing a csv file, and opening it in excel. If this was fixed (or customisable in some way in IE that would help)

  • How can I read "Keys" from a Config File that have square brackets in them?

    I'm using the "Read Key (String).vi" from the config.llb and I'm having a problem because the key names in my file have square brackets in them. I'm creating an VI to read certain pieces of the TestStand �StationGlobals.ini� file and array elements appear as %[0] = "blah blah blah". It looks like they're not getting recognized at all. Is there a way to handle this?

    I was just looking at the code inside the configuration VIs and the way they work under V6 is that the Open VI actually reads the contents of the configuration file, parses it (in nice-platform independent G) and stores it in a fancy LV2-style global called the "Config Data Registry.vi". The routine that does the parsing is called "String to Config Data.vi". My gut reaction is that this code is going to be the same in your version because between sometime prior to V6 of LV, NI changed the location of a couple terminals on the low-level Match String function and it looks like when this code was originally written the terminals were in the old configuration.
    In any case, if your square-bracket containing strings are getting lost, this is probib
    ly where it's happening at. The other place to check is in the read VI itself. The V6 VI for reading the configuration registry is called "Config Data Get Key Value.vi". It's output is then further parsed by a function called "Parse Store String.vi" if the "read raw string?" input is set to False (the default position).
    Given that all the code for these functions are written in LV, you should be able to fix your VIs to read the strings you have in the ini file now. Which IMHO is actually the way they should work.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Square brackets around name of pdf preset

    Hey folks, I have custom pdf presets that are used to output PDFs from Adobe InDesign CS3 on the Windows OS. These presets are in the usual default folder: C:\Documents and Settings\All Users\Application Data\Adobe\Adobe PDF\Settings\ and are included with a bunch of the default settings. At any rate, when I open InDesign and choose Adobe PDF Presets from the File menu, all of the settings are visible. However, they all have square brackets around the name, [myCustomIDPDFPreset]. I expect this result from the default job options that ship with Adobe but not in my custom presets. This is an issue because our output scripts use the specific name of the preset to output PDF content so the inclusion of the square brackets causes it to fail. Any thoughts on how the custom presets can appear in the list without square brackets. This was how it worked in CS2. Thks, Wil

    Here is a screen shot of what's in my ID CS4 PDF Export options. All have brackets.
    Here's what a search for "joboptions" returns. I'm on Intel iMac running 10.5.8. CS4.

  • Matching substrings between square brackets using regular expressions

    Hello,
    I am new at Java and have a problem with regular expressions. Let me describe the issue in 3 steps:
    1.- I have an english sentence. Some words of the sentence stand between square brackets, for example "I [eat] and [sleep]"
    2- I would like to match strings that are in square brackets using regular expressions (java.util.regex.*;) and here is the code I have written for the task
    +Pattern findStringinSquareBrackets = Pattern.compile("\\[.*\\]");+
    +     Matcher matcherOfWordInSquareBrackets = findStringinSquareBrackets.matcher("I [eat] and [sleep]");+
    +//Iteration in the string+
    +          while ( matcherOfWordInSquareBrackets.find() )+
    +{+
    +          System.out.println("Patter found! :"+ outputField.getText().substring(matcherOfWordInSquareBrackets.start(), matcherOfWordInSquareBrackets.end())+"");     +
    +          }+
    3- the result I have after running the code described in 2 is the following: *Patter found!: [eat] and [sleep]*
    That is to say that not only words between square brackets are found but also the substring "and". And this is not what I want.
    What I would like to have as a result is:
    *Patter found!: [eat]*
    *Patter found!: [sleep]*
    That is to say I want to match only the words between the square brackets and nothing else.
    Does somebody know how to do this? Any help would be great.
    Best regards,
    Abou

    You can find the words by looping through the sentence and then return the substring within the indexes.
    int start=0;
    int end=0;
    for(int i=0; i<string.length(); i++)
       if(string.substring(i,i+1).equals("[");
      start=i;
    if(start!=0)
    if(string.substring(i,i+1).equlas("]");
    end=i;
    return string.substring(start,end+1);
    }something like that. This code will only find the firt word however. I do not know much about regex so I cannot help anymore.
    Edited by: elasolova on Jun 16, 2009 6:45 AM
    Edited by: elasolova on Jun 16, 2009 6:46 AM

  • Smartform square brackets or check box

    Hi all,
             Please help me in the issue . I output of the smartform should have checkboxes or square brackets . I tried using standard symbols but i didnt acheive it . can anyone please sugguest me how can i acheive .
    thanks in advance,

    Hi,
    If the check bax you are expecting is for interactive purpose, then you need to go for adobe forms. If it is just for showing in the layout then you can try below 2 ways.
    1. Upload an image of the check box to your SAP system from SE78. Print this graphic as you normally print the LOGO. ( you can create a node of type graphic)
    2. Create a text element and print a single dot. Set the output options of the text element as below.
    Select check box "Lines with" under the frames section. Give the appropriate spacing and width say 1 PT each. Now it shows a small box with the frames. If it is in main window, then you may need to create a template for controlling the width and hight of the element.
    Thanks,
    Vinod.

  • Can't highlight square brackets

    I've recently bought an iPad air (not air 2). Before that I used an iPad 2 running on iOS 6. I have a document in Dropbox I often copied some specific code from including square brackets. Now, on my new iPad running the newest iOS 8, I'm unable to copy or highlight the starting square brackets. No matter how close I zoom in I can't highlight the very first bracket and any other starting brackets '[' disappear when I paste the text. The closing brackets are still there. Does anyone know why this is happening at what I can do to make it stop? It worked just fine on my old iPad and I would be very disappointed if my new iPad can't do something that simple.
    Thanks, Zebrakatten

    Just had the same problem with a german keyboard,
    y was z and z was y.
    Try to search 'Editing a Locale' in the IDE Help, you have to specify the language for the project, you're currently working on.
    It's quite good explained and worked after a relaunch of SJSE (nice job, SUN)

  • What are the square brackets around paragraphs and heads?

    I am hoping that someon can hlep me with this topic. I can not seems to find anything on this matter.
    I have recieved an InDesign file for a book that we are updating the design and content for. All the text in this file has Square brackets, at the begining and end, of each paragraph or head. I have never seen this before, coming from a Quark background.
    The characters are visible in "normal mode", but they disapear when you view in "preview" mode.
    Can anyone please tell me what the Square brackets around text means?

    If you are using OSX this AppleScript should remove all of the XML tags, but test it carefully on a copy of the document:
    tell application "Adobe InDesign CS3"
    try
    untag (every XML element of document 1)
    end try
    end tell
    If you are not on a Mac I'm sure you could get the equivalent JavaScript at the scripting forum.

  • Where's the square bracket key?

    Hey guys. I'm using a Dutch azerty keyboard and I can't find the square bracket keys. I need 'em badly for programming. How can I type them?

    I don't see a Dutch azerty keyboard layout - the Dutch layout is qwerty and the square brackets are to the right of the p key.
    However, for the Belgian layout, which is azerty, [ is Shift-Option-5 and ] is Shift-Option-- (Shift-Option-Hyphen).
    You can hunt for keys yourself (do you remember the Classic utility KeyCaps?)- go to System Preferences > International > Input Menu tab and check the box for Keyboard Viewer. A flag should appear in your menu bar (if not, scroll down to your language and check the box there). Click on the flag in the menu bar and select Show Keyboard Viewer. A mini keyboard will appear, and you can hold down Shift, Option, Ctrl, or any combinations of them and the keys will show you what you get.
    Hope this solves your problem...

  • How to write the regular expression for Square brackets?

    Hi,
    I want regular expression for the [] ‘Square brackets’.
    I have tried to insert in the below code but the expression not validate the [] square brackets.
    If anyone knows please help me how to write the regular expression for ‘[]’ Square brackets.
    private static final Pattern DESC_PATTERN = Pattern.compile("({1}[a-zA-Z])" +"([a-zA-Z0-9\\s.,_():}{/&#-]+)$");Thanks
    Raghav

    Since square brackets are meta characters in regex they need to be escaped when they need to be used as regular characters so prefix them with \\ (the escape character).

Maybe you are looking for

  • Macbook pro 15 mid 2012 with os x 10.8.4 taking long time to boot up

    i am using macbook pro 15 mid 2012 2.6GHz intel core i7 8GB RAM 700GB hard disk my macbook is taking much more time to start and get it ready its taking more than 1min 30sec after system starded its hard to open any application(safari) for starting t

  • Sort Error - failed to parse query

    I'm using APEX 2.2.1 . I have a very detailed report, I wanted to implement a sorting feature into it, where you can click on the title and it'll sort asc or desc. Well Through reading my trusty Oracle manual I decided that a sort option would be the

  • Help about physic simulation in Director 11.5

    Given that: 1) The Help of Director about the functions of physical simulation in 3D is  not very easy to use; 2) I work with 3D max; 3) Havok does not work anymore with Director 11.5; 4) I tried to use the new plug in "AGEIA PhysX" in 3d max " and i

  • Restrictions passcode~reset

    I want to rest my restrictions passcode and I tried watching many youtube videos on how to do so but all of them told me to download icopybot which I don't to do, so is there any way I can reset my restrictions passcode without icopybot.

  • 又改名了..

    SAP Netweaver BI又改成SAP Netweaver BW,而BI是指SAP Business Object BI. 各位要更新一下词汇了. 冒一下泡泡.