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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:59:14+00:00 2026-06-13T22:59:14+00:00

I have created a function in MSSQL 2005 and I want to run this

  • 0

I have created a function in MSSQL 2005 and I want to run this function using linq. My function has 2 parameters. The definition is seen below:

USE [MobileGateway]
GO
/****** Object:  UserDefinedFunction [dbo].[Fn_GetNoLocationAddress]    Script Date: 11/07/2012 08:27:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[Fn_GetNoLocationAddress] 
(   
    -- Add the parameters for the function here
    @Site nvarchar(255),
    @ReceivedDate int
)
RETURNS @noLocationAddress TABLE (

RequestID int NOT NULL,
Barcode varchar(50) NOT NULL,
AdrID int NOT NULL,
Name varchar(50) NOT NULL,
Street varchar(50) NOT NULL,
HouseNo varchar(4) NOT NULL,
Postal varchar(8) NOT NULL,
City varchar(50) NOT NULL,
Country varchar(50) NOT NULL,
Latitude varchar(50) NOT NULL,
Longitude varchar(50) NOT NULL,
ReveivedDate datetime NOT NULL
)
AS 
BEGIN
    -- Add the SELECT statement with parameter references here
INSERT INTO @noLocationAddress 
SELECT     TOP (100) PERCENT Request1.RequestID, TrackIT.dbo.Sending.Barcode, TrackIT.dbo.Address_View.AdrID, TrackIT.dbo.Address_View.Name, 
                      TrackIT.dbo.Address_View.Street, TrackIT.dbo.Address_View.HouseNo, TrackIT.dbo.Address_View.Postal, TrackIT.dbo.Address_View.City, 
                      TrackIT.dbo.Address_View.Country, Request1.Latitude, Request1.Longitude, Request1.ReceivedDate
FROM         (SELECT DISTINCT RequestID, LTRIM([Content]) AS Barcode, Latitude, Longitude, ReceivedDate
                       FROM          dbo.RequestWithLocation
                       WHERE      (Site LIKE @Site) AND ([Content] <> '') AND (AddressID = '0') AND (ReceivedDate > DATEADD(day, -@ReceivedDate, GETDATE()))) AS Request1 INNER JOIN
                      TrackIT.dbo.Sending ON Request1.Barcode = TrackIT.dbo.Sending.Barcode INNER JOIN
                      TrackIT.dbo.Address_View ON TrackIT.dbo.Sending.DeliveryAdrID = TrackIT.dbo.Address_View.AdrID

ORDER BY TrackIT.dbo.Address_View.AdrID

RETURN

END

As you can see I have 2 parameters and I’m returning a table with the information. But I need to use linq for executing the this function.
Can anyone help? thanks

  • 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-13T22:59:15+00:00Added an answer on June 13, 2026 at 10:59 pm

    I am assuming that you are using a dbml (linq to sql) file.

    Drag drop your User defined function from the server explorer in visual studio into your dbml.

    Then from the datacontext object of your dbml you can call the function directly.

    For example if your dbml file name is xyz.dbml then your datacontext object’s name would be ‘XyzDataContext’, unless you have changed it.

    Then try this.

    XyzDataContext db = new XyzDataContext();
    List<Fn_GetNoLocationAddressResult> = db.Fn_GetNoLocationAddress("site", 25).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created this function to check abecedarian with while loop (A word is
I am have created function in mysql. This is code of my function DROP
I have this problem whereby, i have created a user defined function within php.
Using the MySQL query below, I have created a pivot table which is pretty
I have created a Regular Expression (using php) below; which must match ALL terms
I have the following scalar function in MS SQL 2005: CREATE FUNCTION [dbo].[Distance] (
I have created a function that shows/hides different messages according to a combination of
I have created a function which gets an encoded string (possibly UTF-16 not sure)
I have created a function in an application that checks for username and password
I have created a function in PHP that calls a webservice and parses through

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.