Values function t-sql

  • G'day

    was reading Distinct function on technet. There is a bit about VALUES FUNCTION. Anyone has idea how to use it? I tried using like distinct for a column,but I dont think that's the right way. Any help will be appreciated.

  • bhavik.bk (8/21/2014)


    G'day

    was reading Distinct function on technet. There is a bit about VALUES FUNCTION. Anyone has idea how to use it? I tried using like distinct for a column,but I dont think that's the right way. Any help will be appreciated.

    A good start would be to post what you have already tried and we can take it from there.

    😎

  • ok.. i checked this link http://technet.microsoft.com/en-us/library/ee634547%28v=sql.110%29.aspx , which gives me some ideas. But very less examples in relation to using values in coding. i.e.

    you cant use it like you use DISTINCT.

    SELECT DISTINCT customerid

    FROM Employees

    if you replace VALUES with DISTINCT ..it fails...So how do i use it?

  • Quick question, are you using tabular SSAS/dax?

    😎

  • bhavik.bk (8/21/2014)


    ok.. i checked this link http://technet.microsoft.com/en-us/library/ee634547%28v=sql.110%29.aspx , which gives me some ideas. But very less examples in relation to using values in coding. i.e.

    you cant use it like you use DISTINCT.

    SELECT DISTINCT customerid

    FROM Employees

    if you replace VALUES with DISTINCT ..it fails...So how do i use it?

    Like this?

    select distinct v1, v2

    from (values ('1','2'), ('1','2'),('3','4')) as Source (v1,v2)

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 5 posts - 1 through 4 (of 4 total)

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