On Wed, Dec 19, 2012 at 7:48 PM, Vincent Teachout <[email protected]>wrote:
> Hello, > > Does anyone know of a way to select a unique value from an MSSQL table? > > For example: Select My_unique, * from sometable > > I don't care if it's numeric or string, as long as it's unique and generic. > > I need it to be very "vague" as in the above example, so I can iterate > through a list of tables and get all of the values from the table plus a > UID, without having to specify anything specific. > > For example, I can't use RowNum() OVER..... because then I have to specify > the sort order for the table, using a specific field name. > > Clear as mud? any suggestions? > ---------------------------------- No there is no direct function to do that. You could write a sproc to kind of do that but why? I am sure there is a good story for something as bizarre as this. You realize that all of these engines are retrieving what you ask for, so just ask properly. What version of SQL do you have? This may be a good start for you. < http://www.codeproject.com/Articles/308281/How-to-Use-ROW_NUMBER-to-Enumerate-and-Partition-R > -- Stephen Russell Sr. Analyst Ring Container Technology Oakland TN 901.246-0159 cell --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cajidmyjg9v_0fo+mghagzrvkoifkhazaabhejtleyot22fx...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

