Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8350059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:11:44+00:00 2026-06-09T08:11:44+00:00

This one gives the exception: ‘NVARCHAR’ is not a recognized built-in function name. DECLARE

  • 0

This one gives the exception: ‘NVARCHAR’ is not a recognized built-in function name.

DECLARE @BatchIds TABLE
    (
      BatchId AS UNIQUEIDENTIFIER ,
      UserLogonId AS NVARCHAR(80) ,
      ReportStatus NVARCHAR(100) ,
      Created DATETIME ,
      RunTimeInMins AS INT ,
      ReportName NVARCHAR(200)
    )

When I remove the “AS” for NVARCHAR, it does not give any exception.

DECLARE @BatchIds TABLE
    (
      BatchId AS UNIQUEIDENTIFIER ,
      UserLogonId NVARCHAR(80) ,
      ReportStatus NVARCHAR(100) ,
      Created DATETIME ,
      RunTimeInMins AS INT ,
      ReportName NVARCHAR(200)
    )

Any suggestions as to why?

Update:

Please note that my question is more directed towards why AS works different in this situation behind the scenes than trying to solve a work situation.
For those who could not get the 2nd sample working, please try this.
This gives me the same data I inserted without errors and the SQL Server version as
Microsoft SQL Server 2008 R2 (RTM) – 10.50.1600.1 (X64)….

DECLARE @BatchIds TABLE
    (
      UserLogonId NVARCHAR(80) ,
      ReportStatus NVARCHAR(100) ,
      Created DATETIME
    )
INSERT  INTO @BatchIds
        ( UserLogonId ,
          ReportStatus ,
          Created
        )
VALUES  ( 'Test1' ,
          'Test2' ,
          '2012-08-08'
        )

SELECT  *
FROM    @BatchIds
SELECT  @@VERSION AS [Version]

Putting an AS in this query for NVARCHAR throws the same exception as above.

UPDATE:

This is resolved. This behaviour is only when you compile it and SQL Server allows you to compile this. But when you run it, then it throws an exception for any datatype using AS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:11:45+00:00Added an answer on June 9, 2026 at 8:11 am

    You don’t need all those AS keywords that you had – just define your table variable like this:

    DECLARE @BatchIds TABLE
    (
      BatchId UNIQUEIDENTIFIER ,
      UserLogonId NVARCHAR(80) ,
      ReportStatus NVARCHAR(100) ,
      Created DATETIME ,
      RunTimeInMins INT ,
      ReportName NVARCHAR(200)
    )
    

    When trying to run your sample #2 on my SQL Server 2008 R2 (SP1 – Developer Edition), I get these errors:

    Msg 207, Level 16, State 1, Line 3
    Invalid column name ‘UNIQUEIDENTIFIER’.

    Msg 207, Level 16, State 1, Line 7
    Invalid column name ‘INT’.

    I have to remove the AS keywords to make it work. Using AS is trying to define an alias for the column – but since that UNIQUEIDENTIFIER or INT is a reserved keyword in SQL Server, you cannot use those as column aliases. Same for SQL Server 2012 Express – I get those errors, too, and cannot make it work unless I remove those unnecessary AS keywords

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've look for this, and there's some related questions, but no one gives me
For one or another reason this code sample gives 48 hours instead of 24,
Given a class with a member template function like this one: template <typename t>
Please any one give me the suggestion for this. I'm having the Xerces-J-source.zip file
can any one give me the dry output for this program? #include <stdio.h> main()
This is a similar question to this one here . Given a list of
This is one of the solution of getting true or false from given set
ok I give up, how do you do this in one line? public object
In gcc doc one reason is given for using section . This reason is
This is a weird one, but hopefully someone can give me an idea here.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.