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 6329437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:39:53+00:00 2026-05-24T17:39:53+00:00

Migrating asp.net code (VB.net) to use functions and subroutines as parameters. Using MS Server

  • 0

Migrating asp.net code (VB.net) to use functions and subroutines as parameters.
Using MS Server Management Studio to create said functions and subs.
Would like to test the functions from within MS SMS before testing them via the web page.
Here’s an example. Say I have a function called “dbo.getNumber”

I’m trying to test it using the following:

USE [someDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
declare @value int;

select @value = dbo.getNumber;

print @value;
go

When I type F5 (to run the “query”) it gives the following msg:

“The name “dbo.getNumber” is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.”

The function dbo.getNumber was accepted just fine, btw. (It’s counting records of a database that meet certain criteria.)

Hopefully you can infer from the non-working code what I am trying to do.

How can I print the value of a function (for testing purposes) from within SMS?

Correct solution as per James Johnson, below:

USE [someDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
declare @value int;

select @value = dbo.getNumber();

print @value;
go

Note the parens for the function invocation.
Note also: intellisense in SMS underlines dbo.getNumber() as if it were an error, but running the query with F5 works and outputs the right result.

  • 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-24T17:39:54+00:00Added an answer on May 24, 2026 at 5:39 pm

    You need to call it like this:

    select @value = dbo.getNumber()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are in the process of migrating our ASP.NET application to use Jquery instead
I am migrating a web site to a new one using ASP .NET MVC2.
We are migrating ASP code that used ADO to connect to SQL Server 2000.
We're having trouble migrating our ASP.NET applications to Windows Server 2008 R2 x64 and
I am migrating an ASP.NET Web Service toward WCF. The old Web Service endpoint
Recently i am working on migrating the ASP.NET Web application to MVC. I am
I am a PHP developer migrating to C# ASP.Net Framework. As of right now,
Migrating a project from ASP.NET 1.1 to ASP.NET 2.0 and I keep hitting this
We are migrating from asp classic to .net. Unfortunately they named all of the
I am migrating a MonoRail application to ASP.NET MVC and I was wondering if

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.