Forum Replies Created

Viewing 15 posts - 1,201 through 1,215 (of 2,171 total)

  • RE: find the length of ntext datatype variable

    This is very simple error.

    Just as the text suggests, you can't declare local ntext variables.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Recursive Code without using SP

    I don't get why recursive calls are so popular for factorial calculations...

    CREATE FUNCTION dbo.fnFactorial

    (

    @n BIGINT

    )

    RETURNS BIGINT

    AS

    BEGIN

    DECLARE @i BIGINT

    IF @n >= 0 AND...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Recursive Code without using SP

    Is function OK, then?


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: how to remove numbers from strings?

    Sergiy (11/1/2007)


    OK, for dumbs - explaining 3rd time.

    Does this script guarantee order of insertion?

    Were the rows inserted into both tables in the same order?

    Is the order displayed by following SELECTS...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Definition of "Set Based"

    To add another twist.

    I had an argument with Joe Celko about ORDER BY.

    It seems that an ORDER BY operation needs [internally] a CURSOR.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Definition of "Set Based"

    Maybe it was this?

    As I read somewhere once, you don't tell SQL how to do it, you tell SQL what you want, and that's a great way of thinking about...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Finding the top ordered row from a GROUPing

    DECLARE@Sample TABLE (UniqueID INT, NonUniqueID VARCHAR(10), aValue INT)

    INSERT@Sample

    SELECT1, 'A', 10 UNION ALL

    SELECT2, 'A', 2 UNION ALL

    SELECT3, 'A', 5 UNION ALL

    SELECT4, 'B', 4 UNION ALL

    SELECT5, 'B', 8...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: convert from MM/DD/YYYY to YYYYMMDD

    Don't convert nor update!

    Create a calculated column with the new datetimeformat...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Please Help

    Well... Did my suggestion work?


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Finding Min Max of date for 3 different sets which are part of same result set of query

    -- Prepare sample data

    DECLARE@Sample TABLE (Grp CHAR(1), dt DATETIME)

    INSERT@Sample

    (

    Grp,

    dt

    )

    SELECTTOP 100

    CHAR(97 + ABS(CHECKSUM(NEWID())) % 26),

    18000 + ABS(CHECKSUM(NEWID())) % 20000

    FROMmaster..syscolumns AS sc1

    CROSS JOINmaster..syscolumns AS sc2

    -- Show the expected output

    SELECTGrp,

    RecID,

    MAX(CASE WHEN hl =...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Please Help

    You are using SQL Server 2005, right?SELECTExempt_NonExempt,

    Salary

    FROM(

    SELECTjt.Exempt_NonExempt

    Salary,

    ROW_NUMBER() OVER (PARTITION BY jt.Exempt_NonExempt ORDER BY Salary DESC) AS RecID

    FROMEmployee AS e

    INNER JOINJobTitle AS jt ON jt.JobID = e.JobID

    ) AS d

    WHERERecID = 1


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Adding workdays

    Some of you know me by now.

    I just couldn't resist this one!

    Try this inline-function for speed, please...

    CREATE FUNCTION [dbo].[fnAddWorkdays]

    (

    @StartDate DATETIME,

    @DaysToAdd INT

    )

    RETURNS DATETIME

    AS

    BEGIN

    RETURNCREATE FUNCTION [dbo].[fnAddWorkdays]

    (

    @StartDate DATETIME,

    @DaysToAdd INT

    )

    RETURNS DATETIME

    AS

    BEGIN

    RETURNDATEADD(DAY, CASE DATEDIFF(DAY, '17530101',...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Pivot Table Help Needed

    Matt, excellent testing.

    BUT... I am missing data from SQL Profiler regarding CPU/DURATION/READS and WRITES for the different methods used.

    When I started out with SQL Server 2005 and PIVOT operator in...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Count of Nodes Visited in Recursive CTE

    DECLARE@Sample TABLE (ID INT, ParentID INT, Name VARCHAR(100), Amount MONEY)

    INSERT@Sample

    SELECT7, NULL, 'Ljunggren', 1000 UNION ALL

    SELECT3, 1, 'Gulli', 200 UNION ALL

    SELECT8, 7, 'Kerstin', 45 UNION ALL

    SELECT1, NULL, 'Rosberg', 1 UNION ALL

    SELECT4,...


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 15 posts - 1,201 through 1,215 (of 2,171 total)