master.dbo.xp_create_subdir not working for Long Directory names

  • Hi All,

    I have created the attached sp for creating sub directories (which has been later integrated in my restore tool) using xp_create_subdir.

    This works fine for smaller names, but for longer names, the command behaves strangely and does not create sub directories. It is unable to take longer names which is evident from the print commands.

    This behaviour persists in Sql server 2005/2008/2008 R2(not tested in 2012)

    for e.g

    [Create_Dir] 'abcd275_travellinks' works absolutely Fine

    As soon as you run the below command, it gives errors since it is not able to take longer names :

    [Create_Dir] 'abcd275_travellinks'

    Has someone faced the same issue? Any suggesstions would be highly appreciated.

    Thanks in advance.

  • Hi All,

    Although I couldn't understand the exact reason for this behaviour, I changed the datatype to nvarchar(MAX), but still it didn't work out.

    Later, I used a variable to store the values of my Data and Log paths, which I am appending to my DBName and this did the trick for me.

    I have attached the updated sp 🙂

    THANKS !!!

Viewing 2 posts - 1 through 1 (of 1 total)

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