New Code formatting engine rolled out

  • Jeffrey Williams-493691 (10/8/2009)


    Edit: interesting, worked on preview - then gets modified as above.

    Yeah, I noticed that earlier.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I played around with it a little and preview works fine, even if you put in < and > - not sure what is going on there.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Jeffrey Williams-493691 (10/8/2009)


    I played around with it a little and preview works fine, even if you put in < and > - not sure what is going on there.

    Dang it - replaced my < and >. Weird...

    SELECT <<test>> -- edited

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Hmmm...

    SELECT Something FROM SomeWhere WHERE Col1 <> Col2

    DBCC CHECKDB (<Database Name>) WITH NO_INFOMSGS, ALL_ERRORMSGS

    Forums definitely don't like me. :crying:

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • SELECT <Something> FROM SomeWhere WHERE ...

    Well - that didn't work either...

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • <root><row A="A" /></root>

    Just had to try it myself.

    I do all my coding in SSMS, so I never noticed this. Weird that it works if I copy and paste into the window, but not if I type it. Definitely something odd going on there.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • GSquared (10/8/2009)


    I do all my coding in SSMS, so I never noticed this. Weird that it works if I copy and paste into the window, but not if I type it. Definitely something odd going on there.

    I can't even get a direct copy-paste from management studio to behave.

    Code written in management studio. Copy. Paste within code tags.

    SELECT Something FROM SomeWhere WHERE Col1 <> Col2

    Copy, paste, then wrap in code tags

    SELECT Something FROM SomeWhere WHERE Col1 <> Col2

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • declare @XML XML;

    select @XML = '<root>

    <column_name>

    <node_a>value1</node_a>

    <node_b>value2</node_b>

    </column_name>

    </root>';

    select x.y.value('local-name(.)', 'VARCHAR(50)'),

    x.y.value('.', 'VARCHAR(50)')

    from @XML.nodes('//*') x(y);

    And yet, I just posted this in another thread.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • select col from table where othercol > avalue;

    But when I copy-and-pasted this in, it got FUBARed.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Took your code, copied into management studio. Ran it (just to see what it did. XML is not my friend)

    Copy paste back here.

    declare @XML XML;

    select @XML = '<root>

    <column_name>

    <node_a>value1</node_a>

    <node_b>value2</node_b>

    </column_name>

    </root>';

    select x.y.value('local-name(.)', 'VARCHAR(50)'),

    x.y.value('.', 'VARCHAR(50)')

    from @XML.nodes('//*') x(y);

    Hmmm.....

    Typed here

    SELECT * FROM SomeTable WHERE SomeColumn = '<Stuff>'

    SELECT * FROM SomeTable WHERE SomeColumn = <Stuff>

    SELECT * FROM SomeTable WHERE SomeColumn = '<Stuff>Blah</Stuff>'

    SELECT * FROM SomeTable WHERE SomeColumn = <Stuff>Blah</Stuff>

    SELECT * FROM SomeTable WHERE SomeColumn <> <Stuff>Blah</Stuff>

    From management studio

    SELECT * FROM SomeTable WHERE SomeColumn = '<Stuff>'

    SELECT * FROM SomeTable WHERE SomeColumn = <Stuff>

    SELECT * FROM SomeTable WHERE SomeColumn = '<Stuff>Blah</Stuff>'

    SELECT * FROM SomeTable WHERE SomeColumn = <Stuff>Blah</Stuff>

    SELECT * FROM SomeTable WHERE SomeColumn <> <Stuff>Blah</Stuff>

    Browser: Firefox

    Version: 3.5.3

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • select col from table where othercol '>' avalue;

    It's not the single-quotes around it. Some other variable.

    IE version 8.0.6001.18702

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • select col from table where '<xmlstuff />';

    Okay, now that's weird! Why does the other XML code work, but this doesn't?

    I'm gonna go with, "would have to see the code". This is weirder than I thought.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • This makes no sense. Why did your XML come out fine when I posted it, but nothing else I post gets the < and > correct?

    select @XML = '<root>

    <column_name>

    <node_a>value1</node_a>

    <node_b>value2</node_b>

    </column_name>

    </root>';

    select @XML = '<root1>value1</root1>'

    SELECT @XML = '<root2>Value2</root2>'

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • select cast('<row A="A" />' as XML)

    Very weird! This even runs correctly in SSMS, and I really don't see the difference between it and the prior post. I even copied it from the exact same connection window!

    Edit: Note: When typed in SSMS, it has actual brackets, not HTML escape codes.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • GSquared (10/8/2009)


    select cast('<row A="A" />' as XML)

    Very weird! This even runs correctly in SSMS, and I really don't see the difference between it and the prior post. I even copied it from the exact same connection window!

    select cast('<row A="A"/>' as XML) Edited: changed this to [ code="xml" ] and still didn't work...

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 15 posts - 16 through 30 (of 36 total)

You must be logged in to reply to this topic. Login to reply