|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ToString UDTMy UDT works fine on the server and ToString() will work on the type in a
Select. However, even if I install .dll into GAC, SSMS will not display my UDT as a string (i.e. does not call ToString()) so I get byte display instead of string. Anyone know what to look for (i.e. error log, etc.)? -- William Stacey [MVP] I think it doesn call the tostring Method, but your implementation of
the UDT is defined in the attributes of the class as UserDefined. With overriding the ToString() method and implementing you own this should work for you. HTH, Jens Suessmeyer. That is the question. I have the ToString() override already. It is not
called. Others in blogs say this should work using SSMS, but mine does not. One post said it would not work in RTM, so I am not sure if it even should work or not. And SSMS or Help gives not help I found yet. -- Show quoteWilliam Stacey [MVP] "Jens" <J***@sqlserver2005.de> wrote in message news:1137109137.061862.54420@z14g2000cwz.googlegroups.com... >I think it doesn call the tostring Method, but your implementation of > the UDT is defined in the attributes of the class as UserDefined. With > overriding the ToString() method and implementing you own this should > work for you. > > HTH, Jens Suessmeyer. > As far as I know, that's correct behavior. SSMS will never call ToString()
for you automatically. -- Show quoteAdam Machanic Pro SQL Server 2005, available now http://www.apress.com/book/bookDisplay.html?bID=457 -- "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message news:%23NqVmw8FGHA.2212@TK2MSFTNGP15.phx.gbl... > My UDT works fine on the server and ToString() will work on the type in a > Select. However, even if I install .dll into GAC, SSMS will not display > my UDT as a string (i.e. does not call ToString()) so I get byte display > instead of string. Anyone know what to look for (i.e. error log, etc.)? > > -- > William Stacey [MVP] > > > I know it did at one point as I see blog posts about it. Maybe not in RTM.
-- Show quoteWilliam Stacey [MVP] "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message news:%23OGpy0FGGHA.2680@TK2MSFTNGP09.phx.gbl... > As far as I know, that's correct behavior. SSMS will never call > ToString() for you automatically. > > > -- > Adam Machanic > Pro SQL Server 2005, available now > http://www.apress.com/book/bookDisplay.html?bID=457 > -- > > > "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message > news:%23NqVmw8FGHA.2212@TK2MSFTNGP15.phx.gbl... >> My UDT works fine on the server and ToString() will work on the type in a >> Select. However, even if I install .dll into GAC, SSMS will not display >> my UDT as a string (i.e. does not call ToString()) so I get byte display >> instead of string. Anyone know what to look for (i.e. error log, etc.)? >> >> -- >> William Stacey [MVP] >> >> >> > > Right -- it was removed, IIRC, in the September CTP.
-- Show quoteAdam Machanic Pro SQL Server 2005, available now http://www.apress.com/book/bookDisplay.html?bID=457 -- "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message news:OvlHiaGGGHA.3080@TK2MSFTNGP10.phx.gbl... >I know it did at one point as I see blog posts about it. Maybe not in RTM. > > -- > William Stacey [MVP] > > "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message > news:%23OGpy0FGGHA.2680@TK2MSFTNGP09.phx.gbl... >> As far as I know, that's correct behavior. SSMS will never call >> ToString() for you automatically. >> >> >> -- >> Adam Machanic >> Pro SQL Server 2005, available now >> http://www.apress.com/book/bookDisplay.html?bID=457 >> -- >> >> >> "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message >> news:%23NqVmw8FGHA.2212@TK2MSFTNGP15.phx.gbl... >>> My UDT works fine on the server and ToString() will work on the type in >>> a Select. However, even if I install .dll into GAC, SSMS will not >>> display my UDT as a string (i.e. does not call ToString()) so I get byte >>> display instead of string. Anyone know what to look for (i.e. error >>> log, etc.)? >>> >>> -- >>> William Stacey [MVP] >>> >>> >>> >> >> > > Anyone know why this is? It would have seemed to be bone simple to at least
add a check box in options to enable/disable this feature. -- Show quoteWilliam Stacey [MVP] "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message news:e$GGwRIGGHA.1452@TK2MSFTNGP11.phx.gbl... | Right -- it was removed, IIRC, in the September CTP. | | | -- | Adam Machanic | Pro SQL Server 2005, available now | http://www.apress.com/book/bookDisplay.html?bID=457 | -- | | | "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message | news:OvlHiaGGGHA.3080@TK2MSFTNGP10.phx.gbl... | >I know it did at one point as I see blog posts about it. Maybe not in RTM. | > | > -- | > William Stacey [MVP] | > | > "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message | > news:%23OGpy0FGGHA.2680@TK2MSFTNGP09.phx.gbl... | >> As far as I know, that's correct behavior. SSMS will never call | >> ToString() for you automatically. | >> | >> | >> -- | >> Adam Machanic | >> Pro SQL Server 2005, available now | >> http://www.apress.com/book/bookDisplay.html?bID=457 | >> -- | >> | >> | >> "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message | >> news:%23NqVmw8FGHA.2212@TK2MSFTNGP15.phx.gbl... | >>> My UDT works fine on the server and ToString() will work on the type in | >>> a Select. However, even if I install .dll into GAC, SSMS will not | >>> display my UDT as a string (i.e. does not call ToString()) so I get byte | >>> display instead of string. Anyone know what to look for (i.e. error | >>> log, etc.)? | >>> | >>> -- | >>> William Stacey [MVP] | >>> | >>> | >>> | >> | >> | > | > | | Agreed... Put in a "suggestion" and I'll vote for it...
http://lab.msdn.microsoft.com/productfeedback -- Show quoteAdam Machanic Pro SQL Server 2005, available now http://www.apress.com/book/bookDisplay.html?bID=457 -- "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message news:urVSHlKGGHA.3936@TK2MSFTNGP12.phx.gbl... > Anyone know why this is? It would have seemed to be bone simple to at > least > add a check box in options to enable/disable this feature. > > -- > William Stacey [MVP] > > "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message > news:e$GGwRIGGHA.1452@TK2MSFTNGP11.phx.gbl... > | Right -- it was removed, IIRC, in the September CTP. > | > | > | -- > | Adam Machanic > | Pro SQL Server 2005, available now > | http://www.apress.com/book/bookDisplay.html?bID=457 > | -- > | > | > | "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message > | news:OvlHiaGGGHA.3080@TK2MSFTNGP10.phx.gbl... > | >I know it did at one point as I see blog posts about it. Maybe not in > RTM. > | > > | > -- > | > William Stacey [MVP] > | > > | > "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in > message > | > news:%23OGpy0FGGHA.2680@TK2MSFTNGP09.phx.gbl... > | >> As far as I know, that's correct behavior. SSMS will never call > | >> ToString() for you automatically. > | >> > | >> > | >> -- > | >> Adam Machanic > | >> Pro SQL Server 2005, available now > | >> http://www.apress.com/book/bookDisplay.html?bID=457 > | >> -- > | >> > | >> > | >> "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message > | >> news:%23NqVmw8FGHA.2212@TK2MSFTNGP15.phx.gbl... > | >>> My UDT works fine on the server and ToString() will work on the type > in > | >>> a Select. However, even if I install .dll into GAC, SSMS will not > | >>> display my UDT as a string (i.e. does not call ToString()) so I get > byte > | >>> display instead of string. Anyone know what to look for (i.e. error > | >>> log, etc.)? > | >>> > | >>> -- > | >>> William Stacey [MVP] > | >>> > | >>> > | >>> > | >> > | >> > | > > | > > | > | > > FDBK43960
Cheers. -- Show quoteWilliam Stacey [MVP] "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message news:eJfmIMLGGHA.1032@TK2MSFTNGP15.phx.gbl... | Agreed... Put in a "suggestion" and I'll vote for it... For others reading this thread who want to cast a vote:
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=de626f4e-d1de-4c36-9a0a-d22a4ed31ecc -- Show quoteAdam Machanic Pro SQL Server 2005, available now http://www.apress.com/book/bookDisplay.html?bID=457 -- "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message news:%23rkaaVMGGHA.1288@TK2MSFTNGP09.phx.gbl... > FDBK43960 > Cheers. > > -- > William Stacey [MVP] > > "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message > news:eJfmIMLGGHA.1032@TK2MSFTNGP15.phx.gbl... > | Agreed... Put in a "suggestion" and I'll vote for it... > > The best thing would be to select from the different method or property
from the UDT, therefor you could choose the passed back type. Something like a dropdown box which let you select any of these things which are returning some back. Is that worth commenting on the feedback request, then i would explain this a bit in detail. -Jens Suessmeyer. You mean, for each UDT?
If I understand William's request, he'd like an option somewhere in Tools-Options that lets the user select either binary or ToString when returning UDTs. Of course, I'm not sure that's an easy thing from a SSMS standpoint -- SSMS would have to interrogate any query and add .ToString() in all of the appropriate places. Which would probably be next to impossible, now that I think about it. Although I guess there might be other ways to do it... Perhaps SSMS could pull the assemblies out of the database and invoke instances of the type dynamically in order to call ToString on them itself? That doesn't sound like something I'd want SSMS doing, personally. William, how would you expect this feature to actually work? -- Show quoteAdam Machanic Pro SQL Server 2005, available now http://www.apress.com/book/bookDisplay.html?bID=457 -- "Jens" <J***@sqlserver2005.de> wrote in message news:1137233828.774234.207010@g47g2000cwa.googlegroups.com... > The best thing would be to select from the different method or property > from the UDT, therefor you could choose the passed back type. Something > like a dropdown box which let you select any of these things which are > returning some back. > > Is that worth commenting on the feedback request, then i would explain > this a bit in detail. > > -Jens Suessmeyer. > Something like:
1) Get query 2) When enumerating the columns for display: a) Check if UDT. b) If so and "ToString()" checkbox enabled, load assembly (if not already and can be found in cur dir or GAC). Call ToString(). Which the textbox would do anyway IIRC. c) If not, display the binary hex as they do now without newing a UDT object (note the dll may not be avail on the client anyway) I assume they did something similar to this when it was ~working in a pre RTM build. Curious, I think they are still "loading" the UDT assem if it exists. Because during tests, I could not delete the UDT dll in the SSMS dir after doing a query. So it loaded it, but did not to the ToString() thing. Maybe some old code still running. Does that sound about right? -- Show quoteWilliam Stacey [MVP] "Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message news:evGLa8RGGHA.2012@TK2MSFTNGP14.phx.gbl... | You mean, for each UDT? | | If I understand William's request, he'd like an option somewhere in | Tools-Options that lets the user select either binary or ToString when | returning UDTs. | | Of course, I'm not sure that's an easy thing from a SSMS standpoint -- SSMS | would have to interrogate any query and add .ToString() in all of the | appropriate places. Which would probably be next to impossible, now that I | think about it. Although I guess there might be other ways to do it... | Perhaps SSMS could pull the assemblies out of the database and invoke | instances of the type dynamically in order to call ToString on them itself? | That doesn't sound like something I'd want SSMS doing, personally. | | William, how would you expect this feature to actually work? | | | -- | Adam Machanic | Pro SQL Server 2005, available now | http://www.apress.com/book/bookDisplay.html?bID=457 | -- | | | "Jens" <J***@sqlserver2005.de> wrote in message | news:1137233828.774234.207010@g47g2000cwa.googlegroups.com... | > The best thing would be to select from the different method or property | > from the UDT, therefor you could choose the passed back type. Something | > like a dropdown box which let you select any of these things which are | > returning some back. | > | > Is that worth commenting on the feedback request, then i would explain | > this a bit in detail. | > | > -Jens Suessmeyer. | > | | "William Stacey [MVP]" <william.sta***@gmail.com> wrote in message That makes perfect sense to me, although I wonder how much performance news:ekp3uTTGGHA.3532@TK2MSFTNGP14.phx.gbl... > > a) Check if UDT. > b) If so and "ToString()" checkbox enabled, load assembly (if not > already and can be found in cur dir or GAC). Call ToString(). of SSMS would suffer. It's already pretty slow :( > I assume they did something similar to this when it was ~working in a pre What dir? I've never put a DLL in any specific place before or after > RTM build. Curious, I think they are still "loading" the UDT assem if it > exists. Because during tests, I could not delete the UDT dll in the SSMS > dir after doing a query. So it loaded it, but did not to the ToString() > thing. Maybe some old code still running. loading it -- perhaps I missed that feature along the way. -- Adam Machanic Pro SQL Server 2005, available now http://www.apress.com/book/bookDisplay.html?bID=457 -- | That makes perfect sense to me, although I wonder how much performance Not sure. If the check box is off, then it works same as now - so no speed | of SSMS would suffer. It's already pretty slow :( diff. If it is on, then the slowdown is the first load of the assem, after that, it is just the speed of newing an object, which they are doing anyway (I assume) with SqlDateTime, SqlString, etc. | What dir? I've never put a DLL in any specific place before or after C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE | loading it -- perhaps I missed that feature along the way. which is where sqlwb.exe (SSMS) is located. You would put your assem here so SSMS could find it - or in the GAC. -- William Stacey [MVP] Hi William and Adam,
"2) When enumerating the columns for display: a) Check if UDT. b) If so and "ToString()" checkbox enabled, load assembly (if not already and can be found in cur dir or GAC). Call ToString(). " -What would be the extra step to display the exposed methods or properties which have a appropiate return type (if the Dll is found in the GAC), that the user can choose from ? If it can be found, do the c) from William. Jens Suessmeyer. I suppose they could do it. It may get bit messy. You would need a list of
UDT and what methods/properties you want to pick, then they would need to use reflection to verify that property existed or the method was not void. Possibly a cleaner alternative would be to support a ToString(format). So you set your Format string in the SSMS Options, then it just calls the ToString(string format) overload (if it exists) and your UDT parties on the format string to return the correct string. I suppose they could change this up a bit so all UDT must implement INullable and ISomethingElse. ISomethingElse would include the ToString(format) interface. Maybe a better way, not sure. It is not a bad idea however. Say I have a TDate UDT, maybe I want the default to be "1/1/2005" or maybe I want it to be "January 1st 2005". But surely "0x001239..." is currently not doing me a lot of good on my UDTs. -- Show quoteWilliam Stacey [MVP] "Jens" <J***@sqlserver2005.de> wrote in message news:1137265185.294378.112500@g47g2000cwa.googlegroups.com... | Hi William and Adam, | | "2) When enumerating the columns for display: | a) Check if UDT. | b) If so and "ToString()" checkbox enabled, load assembly (if not | already and can be found in cur dir or GAC). Call ToString(). " | | -What would be the extra step to display the exposed methods or | properties which have a appropiate return type (if the Dll is found in | the GAC), that the user can choose from ? If it can be found, do the c) | from William. | | Jens Suessmeyer. |
Other interesting topics
|
|||||||||||||||||||||||