script error

  • Here is me assuming it's 2008 :blush: What is it they say about assuming !

  • michael.higgins (2/24/2014)


    Here is me assuming it's 2008 :blush: What is it they say about assuming !

    Yeah, I mean it's the SQL Server 2008 forum, surely it must be SQL Server 2008... πŸ˜‰

    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
  • GilaMonster (2/24/2014)


    michael.higgins (2/24/2014)


    Here is me assuming it's 2008 :blush: What is it they say about assuming !

    Yeah, I mean it's the SQL Server 2008 forum, surely it must be SQL Server 2008... πŸ˜‰

    Go figure :crazy:

  • michael.higgins (2/24/2014)


    GilaMonster (2/24/2014)


    michael.higgins (2/24/2014)


    Here is me assuming it's 2008 :blush: What is it they say about assuming !

    Yeah, I mean it's the SQL Server 2008 forum, surely it must be SQL Server 2008... πŸ˜‰

    Go figure :crazy:

    There's nothing in your answer that's 2008-specific, should all work on 2005 just as well.

    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
  • Microsoft SQL Server 2005 - 9.00.4060.00 (X64)

  • GilaMonster (2/24/2014)


    michael.higgins (2/24/2014)


    GilaMonster (2/24/2014)


    michael.higgins (2/24/2014)


    Here is me assuming it's 2008 :blush: What is it they say about assuming !

    Yeah, I mean it's the SQL Server 2008 forum, surely it must be SQL Server 2008... πŸ˜‰

    Go figure :crazy:

    There's nothing in your answer that's 2008-specific, should all work on 2005 just as well.

    Never spotted that to be honest. That is why I only have 3 blue squares and you have 15 :doze:

  • help me to resolve in sql 2005

  • ramyours2003 (2/24/2014)


    help me to resolve in sql 2005

    Identify the simplest component of your problem and tackle it. Try running this:

    CREATE TABLE #DBROLES

    (

    DBName SYSNAME NOT NULL ,

    UserName SYSNAME NOT NULL ,

    db_owner VARCHAR(3) NOT NULL ,

    db_accessadmin VARCHAR(3) NOT NULL ,

    db_securityadmin VARCHAR(3) NOT NULL ,

    db_ddladmin VARCHAR(3) NOT NULL ,

    db_datareader VARCHAR(3) NOT NULL ,

    db_datawriter VARCHAR(3) NOT NULL ,

    db_denydatawriter VARCHAR(3) NOT NULL ,

    db_denydatareader VARCHAR(3) NOT NULL ,

    db_sysadmin VARCHAR(3) NOT NULL ,

    db_serveradmin VARCHAR(3) NOT NULL ,

    db_processadmin VARCHAR(3) NOT NULL ,

    db_dbcreator VARCHAR(3) NOT NULL ,

    Cur_Date DATETIME NOT NULL

    DEFAULT GETDATE()

    )

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • nm

    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
  • got the error while executing

    CREATE TABLE #DBROLES

    (

    DBName SYSNAME NOT NULL ,

    UserName SYSNAME NOT NULL ,

    db_owner VARCHAR(3) NOT NULL ,

    db_accessadmin VARCHAR(3) NOT NULL ,

    db_securityadmin VARCHAR(3) NOT NULL ,

    db_ddladmin VARCHAR(3) NOT NULL ,

    db_datareader VARCHAR(3) NOT NULL ,

    db_datawriter VARCHAR(3) NOT NULL ,

    db_denydatawriter VARCHAR(3) NOT NULL ,

    db_denydatareader VARCHAR(3) NOT NULL ,

    db_sysadmin VARCHAR(3) NOT NULL ,

    db_serveradmin VARCHAR(3) NOT NULL ,

    db_processadmin VARCHAR(3) NOT NULL ,

    db_dbcreator VARCHAR(3) NOT NULL ,

    Cur_Date DATETIME NOT NULL

    DEFAULT GETDATE()

    )

    error :Msg 2715, Level 16, State 7, Line 1

    Column, parameter, or variable #1: Cannot find data type SYSNAME.

  • 4th time... Is your server case-sensitive?

    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
  • sorry .. its a CS

  • Right, since it's case sensitive, any user data types (and that includes sysname) have to exactly match in case what they're specified in sys.types. Database names have to exactly match in case what they are specified as in sys.databases

    Go check what case the type is listed as in the catalog views and use exactly that case in all of your code (and if you explicitly refer to TempDB, you'll have to check what case it is specified as in the catalog views)

    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
  • @mic

    i executed the script which u provided but i didnot get any output when i removed comments under

    -- Remove the comments below if you want to execute this!

    --EXECUTE (@mSql1)

    PRINT @msql1

    FETCH NEXT FROM DBName_Cursor INTO @dbname

    END

    i got the error declare the varaiable @mSQL1

  • This is likely to do with what Gail has mentioned already. Your database collation is case sensitive and as such anywhere you use the variable from the point of declaration will need to be in the same case in order for it to work.

Viewing 15 posts - 16 through 29 (of 29 total)

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