Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Calling UDF from Windows Form C#

Author  Topic 

shireen
Starting Member

7 Posts

Posted - 2009-07-16 : 03:48:06
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- =============================================
-- Author: Shireen
-- Create date:
-- Description: Returns the Table for Sector Hour
-- =============================================
ALTER FUNCTION [dbo].[SectorHourFunction]
(
-- Add the parameters for the function here
@start_date datetime,
@end_date datetime,
@vendor_sector_name varchar(50)
)
RETURNS @SectorHour TABLE
(
[DL Mbytes] float,
[DL Qam16 Mbytes] float,
[DL Qam64 Mbytes] float,
[DL Qpsk Mbytes] float,
[UL Mbytes] float,
[UL Qam16 Mbytes] float,
[UL Qpsk Mbytes] float,
[DL Slot Utilization %] float,
[UL Slot Utilization %] float,
[Initial Ranging Requests] float,
[Initial Ranging Success %] float,
[Maximum Simultaneous Users] float,
[Attach Setup Requests] float,
[Successful Attach Setup Requests] float,
[Attach Setup Success Rate] float
)
AS
BEGIN
Insert into @SectorHour

select
wmx_dl_traffic_bytes/(1048576) ,
wmx_qam16_dl_traffic_bytes/(1048576) ,
wmx_qam64_dl_traffic_bytes/(1048576) ,
wmx_qpsk_dl_traffic_bytes/(1048576) ,
wmx_ul_traffic_bytes/(1048576) ,
wmx_qam16_ul_traffic_bytes/(1048576),
wmx_qpsk_ul_traffic_bytes/(1048576) ,
round(wmx_dl_slot_utilization,0) ,
round(wmx_ul_slot_utilization,0) ,
wmx_no_of_initial_ranging_requests ,
wmx_initial_ranging_success_percentage,
wmx_no_of_simultaneous_users ,
wmx_no_of_attach_setup_requests ,
wmx_no_of_successful_attach_setup_requests ,
wmx_attach_setup_success_rate
from AlcStatsKhi where
wmx_datetime>=@start_date and wmx_Datetime<=@end_date
and wmx_vendor_sector_name=@vendor_sector_name
-- Fill the table variable with the rows for your result set

RETURN
END



How do i call this from a C# Form?????

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-07-16 : 07:37:43
Not sure, try
EXEC "Select * from [dbo].[SectorHourFunction] (@Start_Date,@End_Date,@vendor_sector_name)"

Jim
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-16 : 12:32:19
how are trying to access this ? via LINQ?
Go to Top of Page
   

- Advertisement -