Passing Porcedure Parameters using N'

  • The need is to formulate the needed file paths and database name based on an input by my new DBA. I am doing this because I am in need of load balancing the data files on different platters to get some better performance and need to remove the human error in the placement of them.

    After some manipulation I will store the values I need in some variables (varchars) and pass them to the Create Database command. It doesnt work for me because I cannot pass the variable to the command. It doesnt like it. BTW - I have this problem anytime I try to pass a variable to a procedure looking for N' type of information.

    Any suggestions?

    Kindest Regards,
    David

    ** Obstacles are those frightening things that appear when we take our eyes off the goal. **

  • I'm not sure I follow you. Can you post what you've tried and what error it gives please?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Instead of VARCHAR, if you use NVARCHAR, that might address the issue.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • Or build dynamic SQL. For a case like this (CREATE DATABASE command), I wouldn't worry about any performance issues.

  • STUPID!!!!! I never tried using the NVARCHAR declaration! It's the little things we forget. I will let you know if that resolves my problem.

    Kindest Regards,
    David

    ** Obstacles are those frightening things that appear when we take our eyes off the goal. **

  • Not stupid, you just needed a nudge.

    I've been going around telling all & sundry that the bit data type wouldn't take a null. Then Gail just simply tells me I was wrong. I went around bashing myself in the head for a whole day over that one. I still don't know where I got such a mistaken belief.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • We've all done it at least once.

    I told a lot of people that truncate wasn't logged and couldn't be rolled back. Even mentioned that in some code reviews I did.

    Then I tried it. :Whistling:

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 7 posts - 1 through 6 (of 6 total)

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