Forum Replies Created

Viewing 15 posts - 331 through 345 (of 1,229 total)

  • RE: create table valued function

    SQL_Surfer (7/28/2013)


    Can you give me some pointers of rewriting this query? Can data be grabbed at 1 shot instead of doing UNION ALL.

    I think so. Post the whole query and...

  • RE: SQL Query

    vshiva2379 (7/28/2013)


    Execuse me

    Since you did not understand i how given that data and more over i do not want to disclose my original data i have given that, if...

  • RE: SQL Query

    Dird (7/28/2013)


    select name,

    case

    when maths > science and maths > comp then 'maths'

    when comp > science and comp > maths then 'comp'

    else 'science'

    end

    from student

    I think you need another edit...

  • RE: SQL Query

    vshiva2379 (7/28/2013)


    Thank you, But Sorry I didnt Get my result with that

    My table is

    Student

    StudentID int,

    name varchar(20),

    maths int,

    science int,

    comp int

    records are

    1, Allen, 60, 80,75

    2, John ,70,60,90

    3, Kim, 86,85, 80

    result...

  • RE: create table valued function

    It's not really possible to tell if a rCTE would return your resultset more efficiently. Can you post the actual query rather than pseudocode? There is a far more efficient...

  • RE: Add one MilliSecond to each row

    AndrewSQLDBA (7/26/2013)


    Hello Everyone

    I am trying something, that I am not sure is possible.

    I have a CreateDate column in a table, there are approx 5000 rows with the same date and...

  • RE: Find integer at end of a string. There *must* be a better solution ?

    thorkil (7/25/2013)


    Hi

    I want to find an integer after a hyphen in a string. If found, then use it. If not, then return -1

    What do you want to do with 123.4?

  • RE: How can I write this in single select query ?

    prabhu.st (7/25/2013)


    Thanks Guys,

    for reading my post,

    finaly i got it,

    yes,it is possible in the single query, it is..

    select max(item) over()item from my_table where id = 5

    Thanks,

    Prabhu

    No, that doesn't work. It returns...

  • RE: How can I write this in single select query ?

    prabhu.st (7/25/2013)


    ... CTE, SubQuery,JOINs,Derived Tables,

    All of these are elements of a single query. What do you really mean? If you mean "using a single query and without using any...

  • RE: Fuzzy searching

    I've had some good results from this in recent years:

    USE [Matching]

    GO

    /****** Object: UserDefinedFunction [dbo].[IF_Levenshtein01] Script Date: 25/07/2013 10:00:08 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    -- this will score...

  • RE: Need urgent help with query

    Can you post up a sample data script please?

  • RE: Trying to convert varchar to datetime

    savycara (7/24/2013)


    Actually 2011 is year and 4 is month which shoud be represented as 04 and date is 01 (which is to be added)

    I need this column data...

  • RE: More efficient way to perform a lookup?

    r_noob (7/15/2013)

    ... ON (A.Field1 like '% ' + B.LookupValue + ' %')

    That looks like words in a sentence. Try Jeff's splitter: split the sentence on space, remove any leading blanks...

  • RE: Is there an efficient way to do dynamic sorting within SQL ?

    Break up your cte/derived table chain:

    WITH EMPLOYMENT_OPPORTUNITIES_CTE(

    rownumber, id,title,contactperson,lastmodified,description,workexperiencetypeid,

    workexperience,jobtypeid,AcademicExperienceTypeId,

    industryid,industryid2,industryid3,salaryminid,salarymaxid,

    jobTitle,city,state,PostalCode,positions,deadline)

    AS

    (

    SELECT top 4000 -- top 4000 what? Hair colour? Use ORDER BY or risk random and unpredictable results!

    ROW_NUMBER() OVER (ORDER BY lastmodified DESC)...

Viewing 15 posts - 331 through 345 (of 1,229 total)