Forum Replies Created

Viewing 15 posts - 271 through 285 (of 1,228 total)

  • RE: COMPARE COLUMNS OF TWO TABLES AND POPULATE THE FLAG COLUMNS

    -- always check the equivalent SELECT is returning an appropriate result set

    SELECT a.ID, b1.ID, b2.ID,

    FLAGB1 = CASE WHEN b1.ID IS NULL THEN 'N' ELSE 'Y' END,

    FLAGB2 = CASE...

  • RE: tuning query using max() over(partition by) clause

    venus.pvr (1/31/2014)


    anyone can think of anything for this one. I have n't been able to figure it. Thanks

    Your query almost certainly isn't doing what you are expecting. The column Usr...

  • RE: Working If Statement

    Read about BEGIN in books online. Which statements do you expect to be executed when IF returns true?

  • RE: Old SQL Code and Compatibility

    homebrew01 (1/30/2014)


    We haven't written any code like that in a while. It is easy to search for '*=' and find the left joins. Not so easy to find the...

  • RE: How to use scalar function without WHILE

    vip.blade (1/27/2014)


    Hi,

    thanks for your fast response! It's a function to calculate the Levenshtein-Distance from this article: http://www.sqlservercentral.com/articles/Fuzzy+Match/92822/

    As far as I know there is no way to transform...

  • RE: How to use scalar function without WHILE

    You're welcome. If you've run the code you will have noticed that you get duplicates - the same name pair appears twice in the result set, a.firstname + b.firstname and...

  • RE: How to use scalar function without WHILE

    -- you have to test each row against all the other rows in the table i.e. CROSS JOIN:

    ;WITH [50RandomRows] AS (SELECT TOP 50 * FROM [AdventureWorks2012].[Person].[Person] ORDER BY NEWID())

    SELECT

    a.BusinessEntityID,...

  • RE: ProperCase Function

    This thread has been fun to watch, thanks folks! Here's an option I'm surprised nobody posted up:

    CREATE FUNCTION [dbo].[IF_ProperWithREPLACE]

    (

    @inputstring VARCHAR(8000)

    )

    RETURNS TABLE WITH SCHEMABINDING

    AS

    RETURN

    (

    SELECT ProperisedString =

    REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(

    REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(

    REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(

    ' '+@inputstring COLLATE...

  • RE: Return random records in a table-valued function?

    pietlinden (1/9/2014)


    Correct. It's modeling cancer treatment therapy, so sometimes they get fatal complications, and after that you can't test them anymore. (Cheery huh?)

    1989/90 I worked for a while in...

  • RE: Return random records in a table-valued function?

    Each enrollee has a (random) small number of cycles, each cycle has a (random) number of symptoms - is this correct?

    If a group 5 symptom is allocated at any point,...

  • RE: insert twice seems to pick up new id

    Looking at the original code, it appears fine. A test harness works fine too, showing that your theory is sound:

    CREATE TABLE #tbl_directdebits (

    ID INT IDENTITY(1,1),

    ref VARCHAR(2),

    recurperiod VARCHAR(2),

    servicelevel VARCHAR(2),...

  • RE: SQL Help needed...

    Sean Lange (1/8/2014)


    satishchandra (1/8/2014)


    Jeff, Here is the code for split function..

    Take a look at the link provided by Jeff above or the same link in my signature about splitting strings....

  • RE: SLICING DATA IN A TABLE

    Which is probably faster than this, but you get the idea:

    WITH SampleData (VendorNbr, CCode, PayDate, NetPaid) AS (

    SELECT 'AAAAAAAAA', 1, 20120101, 3000.00 UNION ALL

    SELECT 'AAAAAAAAA', 1, 20120101, 6000.00 UNION ALL

    SELECT...

  • RE: help with insert query

    harita (1/8/2014)


    hi all

    I am trying to insert from tableA to tableB

    there are 1000 records in tableA and I want to insert 100 records at a time into tableB

    idea is to...

Viewing 15 posts - 271 through 285 (of 1,228 total)