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 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 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 a web site to a new one using ASP .NET MVC2.
I'm building an ASP.NET MVC site where I want to use DotNetOpenAuth to implement
I am working on migrating the ASP.NET apllication to MVC Framework. I have implemented
I have been using the following regular expression in ASP.NET and Javascript: [a-zA-ZöäüÖÄÜß0-9]{1}[a-zA-ZöäüÖÄÜß0-9_.\-]{2,14}[a-zA-ZöäüÖÄÜß0-9.!]{1} Now,
We are migrating our web sites from Win2003/IIS6 to Win2008/IIS7. Our .NET code is
i am migrating a website from asp to asp.net. i have some asp pages
We have an ASP.NET 3.5 app running in IIS6 we're migrating to IIS7 &
I have a website in which I am migrating membership from ASP.NET services to

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.