Tech Off Thread

10 posts

Why doesn't this SQL work?

Back to Forum: Tech Off
  • User profile image
    qwert231

    I'm not sure why this isn't working

  • User profile image
    ZippyV

    Too small, unreadable.

  • User profile image
    dpratt71

    It is a bit small, but the first couple lines appears to be:


    DB_ID(N'IntranetApps')
    GO

    What is this code supposed to be doing? My first guess was that you were trying to switch the connection's current database to "IntranetApps", which would look like this:

    USE IntranetApps
    GO

    But the rest of the code doesn't require that. Remove it?

  • User profile image
    dpratt71

    dpratt71 said:
    It is a bit small, but the first couple lines appears to be:

    DB_ID(N'IntranetApps')
    GO

    What is this code supposed to be doing? My first guess was that you were trying to switch the connection's current database to "IntranetApps", which would look like this:

    USE IntranetApps
    GO

    But the rest of the code doesn't require that. Remove it?
    Hmm...Formatting is not what I expected (based on the preview), but hopefully you get the idea.

  • User profile image
    Dodo

    qwert231 said:
    I'm not sure why this isn't working

    And I'm not sure why you posted this extremely small screenshot instead of copy'n'pasting the code as text. I tried text detection and sharpening filters on the image and still couldn't read it.

  • User profile image
    joechung

    Dodo said:
    qwert231 said:
    *snip*

    And I'm not sure why you posted this extremely small screenshot instead of copy'n'pasting the code as text. I tried text detection and sharpening filters on the image and still couldn't read it.
    DB_ID(N'IntranetApps')
    GO

    SELECT * FROM sys.dm_db_index_physical_stats
    (DB_ID(N'IntranetApps'), OBJECT_ID(N'...'), NULL, NULL, 'DETAILED')
    GO

    where ... is the name of an object in his database.

    qwert231, check out example C in DB_ID (Transact SQL) [MSDN].

  • User profile image
    Sven Groot

    joechung said:
    Dodo said:
    *snip*
    DB_ID(N'IntranetApps')
    GO

    SELECT * FROM sys.dm_db_index_physical_stats
    (DB_ID(N'IntranetApps'), OBJECT_ID(N'...'), NULL, NULL, 'DETAILED')
    GO

    where ... is the name of an object in his database.

    qwert231, check out example C in DB_ID (Transact SQL) [MSDN].

    You can get SQL formatting like this: [ code language="SQL" ] code here [ /code ]
    Just remove the extra spaces around the [].

    EDIT: Ok, apparently that doesn't work. I know the code formatter they use supports SQL (since I wrote it Tongue Out ), but apparently C9 isn't exposing it.

  • User profile image
    TommyCarlier

    Sven Groot said:
    joechung said:
    *snip*
    You can get SQL formatting like this: [ code language="SQL" ] code here [ /code ]
    Just remove the extra spaces around the [].

    EDIT: Ok, apparently that doesn't work. I know the code formatter they use supports SQL (since I wrote it Tongue Out ), but apparently C9 isn't exposing it.
    SELECT * FROM sys.databases
    Edit: it works when you put "sql" in lower case letters. Yay for case-sensitivity.

  • User profile image
    TommyCarlier

    Sven Groot said:
    joechung said:
    *snip*
    You can get SQL formatting like this: [ code language="SQL" ] code here [ /code ]
    Just remove the extra spaces around the [].

    EDIT: Ok, apparently that doesn't work. I know the code formatter they use supports SQL (since I wrote it Tongue Out ), but apparently C9 isn't exposing it.
    Duplicate.

  • User profile image
    littleguru

    Dodo said:
    qwert231 said:
    *snip*

    And I'm not sure why you posted this extremely small screenshot instead of copy'n'pasting the code as text. I tried text detection and sharpening filters on the image and still couldn't read it.
    Yeah... he's a source of unanswered questions. And now we are at a question without a question Big Smile

  • Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.