#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Sweden
    Posts
    6
    Rep Power
    0

    Unhappy what is wrong???


    create function SvensktDatum2(@indate datetime, @separator char(1))
    returns nchar(20)
    as
    begin
    return
    convert(nvarchar(20), datepart(yyyy, @indate))
    + @separator
    declare @manad nvarchar(20)
    if (datepart(mm, @indate)between 1 and 6)
    begin
    set @manad ='0'+ (datepart(mm, @indate))
    + convert(nvarchar(20), @manad)
    end
    else
    begin
    set @manad = (datepart(mm, @indate))
    + convert(nvarchar(20), @manad)
    end

    + @separator

    declare @dag nvarchar(20)
    if (datepart(dd, @indate)between 1 and 6)
    begin
    set @dag ='0'+ (datepart(dd, @indate))
    + convert(nvarchar(20), @dag)
    end
    else
    begin
    set @dag = (datepart(dd, @indate))
    + convert(nvarchar(20), @dag)
    end
    end

    I get this message:

    Server: Msg 170, Level 15, State 1, Procedure SvensktDatum2, Line 20
    Line 20: Incorrect syntax near '+'.
    Last edited by buggirl; September 25th, 2003 at 03:14 PM.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,595
    Rep Power
    4207
    The error message seems pretty clear to me.. See line 20 of your stored proc where it says:
    + @separator

    That section seems to be by itself and is not part of any expression or anything .

    BTW are you a Swedish speaker by any chance?
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Sweden
    Posts
    6
    Rep Power
    0
    Well now, I've solved my problem and yes I am a Swedish speaker!!!

IMN logo majestic logo threadwatch logo seochat tools logo