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

  • Home
  • SEARCH
  • 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 4248156
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:12:47+00:00 2026-05-21T04:12:47+00:00

I have created a TVP and I am trying to use it in a

  • 0

I have created a TVP and I am trying to use it in a stored proc for my input into stored proc.
the issue is I am not able to create my SP with it. Its says

Msg 137, Level 16, State 1, Procedure uspGetUsersPresentCount, Line 14
Must declare the scalar variable "@usersList".

My SP is

IF EXISTS (SELECT * FROM sysobjects WHERE name = 'uspGetUsersPresentCount')
    BEGIN
        DROP  Procedure  [AMProcedures].[uspGetUsersPresentCount]
    END

GO


SET ANSI_NULLS ON
GO 

SET QUOTED_IDENTIFIER ON
GO

CREATE PROC [AMProcedures].[uspGetUsersPresentCount]
(
    @usersList AS [AMProcedures].[udfUserListTVP] READONLY,
    @startDate DATETIME,
    @endDate DATETIME
)
AS
BEGIN
DECLARE @okStatus TINYINT = 4
SET NOCOUNT ON

    SELECT MIMO.UserID, COUNT(MIMO.MoveInTime) FROM AMTables.tblUserMoveInMoveOutDetails MIMO
        JOIN @usersList ON MIMO.UserID=@usersList.UserID
            WHERE MIMO.Status=@okStatus AND
                MIMO.MoveInTime BETWEEN @startDate AND @endDate
            GROUP BY MIMO.UserID

SET NOCOUNT OFF

END
GO

can anyone tell me what wrong am I doing …I have tried what I knew, but nothing seems to work.

Thanks in advanced.

  • 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-05-21T04:12:47+00:00Added an answer on May 21, 2026 at 4:12 am

    Either use an alias for the user list, or put it in square braces:

    JOIN @usersList UL ON MIMO.UserID=UL.UserID
    

    or

    JOIN @usersList ON MIMO.UserID=[@usersList].UserID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a class to manage a SQLite database. Part of its code
Have created a small two tab app, then subclassed another view controller to create
I have created 2 classes A,B for JUnit, each has its own ContextLoaders for
Have created an android test project and currently trying to write android unit tests
Have created a UIButton programmatically, all works as expected but how can I use
I have created my first asp.net UserControl that I will use in several places
Have created a stored procedure which is utilised for monitoring purposes of a website.
have created a map that I'm trying to have function similar to 'My Maps'.
i have created a table in mysql to store polygon data: CREATE TABLE geom
i have created a running process which listens for input: listen = Popen([home/user/listen], stdout=PIPE,

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.