How Can I Call MS Access Records From A SQL Store Procedure

Nov 30, 2004

How can I get MS ACCES database records from an sql Stored Procedure. Idea is I have a SQL stored procedure, which wants to calculate a few things using some data from an MS access DB. Is it possible or am I talking against any DB principles?

View 1 Replies


ADVERTISEMENT

How To Call A Store Procedure

Aug 1, 2007

I have a stored procedure that creates a normalized table from an existing denorm table. So I just need a simple way to call this SP from an aspx page. It would be good though to know how many records were effected, but this is not a requirement.

View 5 Replies View Related

How To Call Sql Store Procedure In Asp.net

Sep 22, 2004

I create a store procedure in sql, how do I call it?

thankss

View 2 Replies View Related

How To Call Store Procedure

Mar 12, 2008

Hi, how to call the shrink_file proc from shrink_file_caller proc as below??



CREATE PROCEDURE [dbo].[Shrink_File]
@DBName VARCHAR(100),
@err INT OUTPUT
AS
...
GO

CREATE PROCEDURE [dbo].[Shrink_File_Caller]
@DBName VARCHAR(100),
@err INT OUTPUT
AS
SET NOCOUNT ON;
DECLARE @nsql NVARCHAR(4000);

SET @nsql = '' + @DBName + '.dbo.Shrink_File ''' + @DBName + ''', @err OUTPUT' ;
EXEC sp_executesql @nsql,N'@err INT OUTPUT', @err = @err OUTPUT;

GO

declare @err int;

EXEC Shrink_File_CALLER 'DATABASE1', @err

select @err as err;


I get the error:

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'DATABASE1'.

(1 row(s) affected)

View 9 Replies View Related

How Do I Call A Store Procedure With Parameter?

Aug 9, 2006

I have searched this forum for how to call a store procedure with
parameter and so far no result has answered my question yet. I have the
following store procedure:


SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author:        <Author,,Name>

-- Create date: <Create Date,,>

-- Description:    <Description,,>

-- =============================================

CREATE PROCEDURE sqlSearch

    -- Add the parameters for the stored procedure here

    @strSearch varchar(250)

AS

BEGIN

    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;



    -- Insert statements for procedure here

    WHERE ([name_nws] LIKE '%" + @strSearch + "%' OR
[title_nws] LIKE '%" + @strSearch + "%'OR [sub_nws] LIKE '%" +
@strSearch + "%' OR [sum_nws] LIKE '%" + @strSearch + "%' OR
[content_nws] LIKE '%" + @strSearch + "%')

END

GO

I got this far in my code on how to call the parameter store procedure.
string strConn = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString; SqlConnection sqlConn = new SqlConnection(strConn); SqlCommand sqlComm = new SqlCommand(); sqlComm.Connection = sqlConn; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "sqlSearch"; sqlComm.Parameters.Add("@strSearch", SqlDbType.VarChar);  I don't know what do next.

Help is much appreciated.

View 4 Replies View Related

Call Store Procedure From Function

Nov 13, 2007

Hi,is there any method to call a store procedure into a function?ThanksFabio

View 1 Replies View Related

Call Store Procedure From Another Store Procedure

Nov 13, 2006

I know I can call store procedure from store procedure but i want to take the value that the store procedure returned and to use it:

I want to create a table and to insert the result of the store procedure to it.

This is the code: Pay attention to the underlined sentence!

ALTER PROCEDURE [dbo].[test]



AS

BEGIN

SET NOCOUNT ON;



DROP TABLE tbl1

CREATE TABLE tbl1 (first_name int ,last_name nvarchar(10) )

INSERT INTO tbl1 (first_name,last_name)

VALUES (exec total_cash '8/12/2006 12:00:00 AM' '8/12/2006 12:00:00 AM' 'gilad' ,'cohen')

END

PLEASE HELP!!!! and God will repay you in kind!

Thanks!

View 7 Replies View Related

Can I Call Tigger In Store Procedure Or Vice Versa And How?

Jun 19, 2006

Can i call Tigger in store procedure or vice versa in sql server 2000.
 
 and How it implement  ?

View 1 Replies View Related

Store Procedure LOCK. How To Solve The Problem Of Simultaneous Call?

Mar 20, 2007

Hello, I have one store procedure that writes something data to one physical sql table 'MyTable' and on beginning I first call:DELETE FROM MyTableProcedure returns at the end data from 'MyTable' as on SELECT. PROBLEM:I started SQL Manager on my Laptop and on Computer near me and all pointed to same database (on Server) and I run that procedure simultaneously on Laptop and Computer at the same time (two hands on F5 button on these computers). Occasionally when clicking with both hands at the same time I got no records at the end of execution (on both computers), otherwise I got the results.WHAT I THINK IS PROBLEM:Somhow one SP start working and it did not come to the end and another computer called this SP and execute first command (DELETE FROM MyTable) and I got empty records at the end..WHAT I NEED:I need to prevent this situation to get empty records. All computers must get these records always. How I can use some sort of LOCKs to do this?Or to do that on C# application level using LOCK command? Thanks in advanceAleksandar 

View 2 Replies View Related

Insert Multiple Records Using One Stored Procedure Call. SQL SERVER 7

Mar 19, 2008

Hi I have asp.net page with approx 28 dropdowns. I need to insert these records using one stored procedure call. How can I do this while not sacrificing performance?
 
Thanks, Gary

View 9 Replies View Related

Transact SQL :: Generic Store Procedure Call Without Output Parameters But Catching Output

Sep 21, 2015

Inside some TSQL programmable object (a SP/or a query in Management Studio)I have a parameter containing the name of a StoreProcedure+The required Argument for these SP. (for example it's between the brackets [])

EX1 : @SPToCall : [sp_ChooseTypeOfResult 'Water type']
EX2 : @SPToCall : [sp_ChooseTypeOfXMLResult 'TABLE type', 'NODE XML']
EX3 : @SPToCall : [sp_GetSomeResult]

I can't change thoses SP, (and i don't have a nice output param to cach, as i would need to change the SP Definition)All these SP 'return' a 'select' of 1 record the same datatype ie: NVARCHAR. Unfortunately there is no output param (it would have been so easy otherwise. So I am working on something like this but I 'can't find anything working

DECLARE @myFinalVarFilledWithCachedOutput 
NVARCHAR(MAX);
DECLARE @SPToCall NVARCHAR(MAX) = N'sp_ChooseTypeOfXMLResult
''TABLE type'', ''NODE XML'';'
DECLARE @paramsDefintion = N'@CatchedOutput NVARCHAR(MAX) OUTPUT'

[code]...

View 3 Replies View Related

Error Msg 6522, Level 16, State 1 Receives When Call The Assembly From Store Procedure To Create A Text File And To Write Text

Jun 21, 2006

Hi,
I want to create a text file and write to text it by calling its assembly from Stored Procedure. Full Detail is given below

I write a code in class to create a text file and write text in it.
1) I creat a class in Visual Basic.Net 2005, whose code is given below:
Imports System
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Diagnostics
Public Class WLog
Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
End Sub
Public Shared Sub LogIt(ByVal logMessage As String, ByVal wr As StreamWriter)
wr.Write(ControlChars.CrLf & "Log Entry:")
wr.WriteLine("(0) {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString())
wr.WriteLine(" :")
wr.WriteLine(" :{0}", logMessage)
wr.WriteLine("---------------------------")
wr.Flush()
End Sub
Public Shared Sub LotToEventLog(ByVal errorMessage As String)
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog
log.Source = "My Application"
log.WriteEntry(errorMessage)
End Sub
End Class

2) Make & register its assembly, in SQL Server 2005.
3)Create Stored Procedure as given below:

CREATE PROCEDURE dbo.SP_LogTextFile
(
@LogName nvarchar(255), @NewMessage nvarchar(255)
)
AS EXTERNAL NAME
[asmLog].[WriteLog.WLog].[LogToTextFile]

4) When i execute this stored procedure as
Execute SP_LogTextFile 'C:Test.txt','Message1'

5) Then i got the following error
Msg 6522, Level 16, State 1, Procedure SP_LogTextFile, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'SP_LogTextFile':
System.UnauthorizedAccessException: Access to the path 'C:Test.txt' is denied.
System.UnauthorizedAccessException:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, ileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.AppendText(String path)
at WriteLog.WLog.LogToTextFile(String LogName, String newMessage)

View 13 Replies View Related

Data Access :: Stored Procedure Update Multiple Records

Jul 17, 2015

IF EXISTS (SELECT 1 FROM RoleUser WHERE User_Id = 12346 AND Role_Code = 'CRC')
UPDATERoleUser
SETAccess= 1,
Worklist= 0,
Supervisor= 0
WHERERole_Code= 'CRC'

[Code] ....

View 3 Replies View Related

How To Access A .asp Page Or .aspx Page From A Store Procedure In Sql Server 2000

Sep 21, 2006

Hi, I wanted to know that can we access a webpagefrom a store procedure in sql server 2000 like we run a exe file from sql server. Bye.

View 1 Replies View Related

Can I Call Tigger In Store Procdure And Vice Versa??(urgent)

Jun 19, 2006

Can i call tigger in store procdure and vice versa??
 
if yes how it ?????????

View 2 Replies View Related

SQL Call INNER JOIN Returns Too Many Records

Jan 25, 2006

I have my SQL call:
SELECT     CallLog.CallID, Journal.HEATSeqFROM         CallLog INNER JOIN                      Journal ON CallLog.CallID = Journal.CallID
There are multiple enteries in the Journal table for every entry in the CallLog table, so I receive multiple records:
CallID           HEATSeq00000164     983290904 00000164     983291548 00000164     983295209 00000231     984818271 00000231     985194317 00000231     985280248
I only want to return the LAST record in the Journal table, so the output will be:
CallID           HEATSeq00000164     983295209 00000231     985280248
Can this be done directly in the SQL call?

View 7 Replies View Related

Transact SQL :: How To UPDATE More Than 500 Records In One Call

Aug 13, 2015

I have following query which is created dynamically as -

UPDATE  BUILDTABLE  SET BUILD_ID =  '984137'  WHERE SET_NUMBER = '1889147436' AND SEND_DATE = '1941-03-04'; 
UPDATE  BUILDTABLE  SET BUILD_ID =  '984137'  WHERE SET_NUMBER = '1115509374' AND SEND_DATE = '1991-09-01'; 
UPDATE  BUILDTABLE  SET BUILD_ID =  '984137'  WHERE SET_NUMBER = '1515579671' AND SEND_DATE = '1941-05-24'; 
UPDATE  BUILDTABLE  SET BUILD_ID =  '984137'  WHERE SET_NUMBER = '1795509670' AND SEND_DATE = '1958-01-14';
UPDATE  BUILDTABLE  SET BUILD_ID =  '984137'  WHERE SET_NUMBER = '1915508672' AND SEND_DATE = '1961-09-07';

Here till " UPDATE BUILDTABLE SET BUILD_ID =  '984137'" is the same clause for all queries, but "where" condition is different for all queries. I have to update more than 500 UPDATE statements(like above) in one call. Currently I am concatenating all the queries in string Builder which is time consuming.I want to increase performance of application.Any other class like BulkCopy ?

View 18 Replies View Related

Find Phonecall Records Based On User At The Time Of Call

Oct 8, 2006

i have a table of phonecall records detailing amongst other things the time and duration of the call. there is a relationship linking this table to a table of handsets and from there to a table of users. this users table lists the start date the user had the phone. as ever sample data might make this easier to show:

PhoneUsers table

PhoneUserID Name StartDate PhoneID

1 john 1/08/2006 1

2 bob 20/08/2006 1

3 fred 2/08/2006 2

etc

Phones table:

PhoneID

1

2

etc

PhoneCalls table:

PhoneCallID PhoneID CallDate Duration

1 1 10/08/2006 25

2 1 23/082006 20

3 2 23/08/2006 20

i want the following result set:

user calldate duration

john 10/08/2006 25

bob 23/08/2006 20

fred 23/08/2006 20

essentially i am trying to link the phonecalls to the user of the phone at the time of the call. i make the following assumptions regarding the data:

the user is responsible for all calls for a given handset from the 'startdate' until the next 'startdate' for a different user, if such a record exists, if not then for all calls after that date



thanks



View 1 Replies View Related

Call Stored Procedures Or Job From Access

Nov 20, 2003

How can I get a group of stored procedures or a job to run on the sql server from Access?

Thanks

View 1 Replies View Related

ODBC-Call Failed - Access

Sep 15, 2006

We have this fairly simple Access database with a link table to a view in an SQL Server. The Select Query in Access is a simple select from this view with a view criteria set. Nothing fancy. What is driving is moderately crazy is that this Select Query in Access seems to work fine for months and than all of a sudden (same query performed around the same time with about the same workload on the SQL-Server) it responses with the helpful "ODBC-Call Failed" message. Closing the Access database, taking a coffee, coming back againg and try the exact same Select Query normally works, no "ODBC-Call Failed" message.

It not happens always, mosty we're fine.
When it happens it happens for all subsequent queries tried. We have to close and reopen the Access database and pray to the good Lord that it works.

We would be very interested in someone with a solution to this problem.

View 20 Replies View Related

MS Access ODBC Call Failed

Nov 14, 2007

I am having an issue that i can't seem to resolve. By no means am I an expert with odbc connections and what not but any help would be great.

here is my issue. I have a 64 Bit terminal server that is running MS Access. I have defined my DSN within the 32 bit admin utility and it connects without a problem As soon as i try to link tables and make a connection to the database from within Access i recieve an "ODBC CALL FAILED" message.

I enabled tracing and here is what i got.....this doesn't mean anything to me but hopefully it does to someone.....


PaintJobShip_Ma 1388-ecc ENTER SQLAllocEnv
HENV * 002DB3C4

PaintJobShip_Ma 1388-ecc EXIT SQLAllocEnv with return code 0 (SQL_SUCCESS)
HENV * 0x002DB3C4 ( 0x07f42538)

PaintJobShip_Ma 1388-ecc ENTER SQLAllocConnect
HENV 07F42538
HDBC * 002DB4D4

PaintJobShip_Ma 1388-ecc EXIT SQLAllocConnect with return code 0 (SQL_SUCCESS)
HENV 07F42538
HDBC * 0x002DB4D4 ( 0x07f425e0)

PaintJobShip_Ma 1388-ecc ENTER SQLSetConnectOption
HDBC 07F425E0
SQLINTEGER 103 <SQL_LOGIN_TIMEOUT>
SQLPOINTER 0x00000014

PaintJobShip_Ma 1388-ecc EXIT SQLSetConnectOption with return code 0 (SQL_SUCCESS)
HDBC 07F425E0
SQLINTEGER 103 <SQL_LOGIN_TIMEOUT>
SQLPOINTER 0x00000014 (BADMEM)

PaintJobShip_Ma 1388-ecc ENTER SQLSetConnectAttrW
SQLHDBC 07F425E0
SQLINTEGER 30002 <unknown>
SQLPOINTER [Unknown attribute 30002]
SQLINTEGER -3

PaintJobShip_Ma 1388-ecc EXIT SQLSetConnectAttrW with return code 0 (SQL_SUCCESS)
SQLHDBC 07F425E0
SQLINTEGER 30002 <unknown>
SQLPOINTER [Unknown attribute 30002]
SQLINTEGER -3

PaintJobShip_Ma 1388-ecc ENTER SQLDriverConnectW
HDBC 07F425E0
HWND 000800D4
WCHAR * 0x4BF78088 [ -3] "****** 0"
SWORD -3
WCHAR * 0x4BF78088
SWORD 2
SWORD * 0x00000000
UWORD 1 <SQL_DRIVER_COMPLETE>

PaintJobShip_Ma 1388-ecc EXIT SQLDriverConnectW with return code -1 (SQL_ERROR)
HDBC 07F425E0
HWND 000800D4
WCHAR * 0x4BF78088 [ -3] "****** 0"
SWORD -3
WCHAR * 0x4BF78088
SWORD 2
SWORD * 0x00000000
UWORD 1 <SQL_DRIVER_COMPLETE>

DIAG [S1000] [Oracle][ODBC][Ora]ORA-06413: Connection not open.
(6413)

DIAG [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed (0)

DIAG [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed (0)

PaintJobShip_Ma 1388-ecc ENTER SQLErrorW
HENV 07F42538
HDBC 07F425E0
HSTMT 00000000
WCHAR * 0x002DB390 (NYI)
SDWORD * 0x002DB3DC
WCHAR * 0x036A4458
SWORD 4095
SWORD * 0x002DB3C8

PaintJobShip_Ma 1388-ecc EXIT SQLErrorW with return code 0 (SQL_SUCCESS)
HENV 07F42538
HDBC 07F425E0
HSTMT 00000000
WCHAR * 0x002DB390 (NYI)
SDWORD * 0x002DB3DC (6413)
WCHAR * 0x036A4458 [ 102] "[Oracle][ODBC][Ora]ORA-06413: Connection not open. a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
SWORD 4095
SWORD * 0x002DB3C8 (102)

PaintJobShip_Ma 1388-ecc ENTER SQLErrorW
HENV 07F42538
HDBC 07F425E0
HSTMT 00000000
WCHAR * 0x002DB390 (NYI)
SDWORD * 0x002DB3DC
WCHAR * 0x036A44D6
SWORD 4032
SWORD * 0x002DB3C8

PaintJobShip_Ma 1388-ecc EXIT SQLErrorW with return code 0 (SQL_SUCCESS)
HENV 07F42538
HDBC 07F425E0
HSTMT 00000000
WCHAR * 0x002DB390 (NYI)
SDWORD * 0x002DB3DC (0)
WCHAR * 0x036A44D6 [ 66] "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed"
SWORD 4032
SWORD * 0x002DB3C8 (66)

PaintJobShip_Ma 1388-ecc ENTER SQLErrorW
HENV 07F42538
HDBC 07F425E0
HSTMT 00000000
WCHAR * 0x002DB390 (NYI)
SDWORD * 0x002DB3DC
WCHAR * 0x036A456C
SWORD 3957
SWORD * 0x002DB3C8

PaintJobShip_Ma 1388-ecc EXIT SQLErrorW with return code 0 (SQL_SUCCESS)
HENV 07F42538
HDBC 07F425E0
HSTMT 00000000
WCHAR * 0x002DB390 (NYI)
SDWORD * 0x002DB3DC (0)
WCHAR * 0x036A456C [ 66] "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed"
SWORD 3957
SWORD * 0x002DB3C8 (66)

PaintJobShip_Ma 1388-ecc ENTER SQLErrorW
HENV 07F42538
HDBC 07F425E0
HSTMT 00000000
WCHAR * 0x002DB390 (NYI)
SDWORD * 0x002DB3DC
WCHAR * 0x036A4602
SWORD 3882
SWORD * 0x002DB3C8

PaintJobShip_Ma 1388-ecc EXIT SQLErrorW with return code 100 (SQL_NO_DATA_FOUND)
HENV 07F42538
HDBC 07F425E0
HSTMT 00000000
WCHAR * 0x002DB390 (NYI)
SDWORD * 0x002DB3DC
WCHAR * 0x036A4602
SWORD 3882
SWORD * 0x002DB3C8

PaintJobShip_Ma 1388-ecc ENTER SQLFreeConnect
HDBC 07F425E0

PaintJobShip_Ma 1388-ecc EXIT SQLFreeConnect with return code 0 (SQL_SUCCESS)
HDBC 07F425E0


any help would be great....thanks.

View 3 Replies View Related

How To Store Multiple Records Feasibly

Aug 11, 2014

Am doing a simple application.Am using vb.net and sql server 2008.

Functionality:

For customers, I need to store the entered amount daily.
Eg as follows:

Name 01/01 02/01 03/01 04/01 ------ 17/04 18/04 (100 days from JAN to APRIL)

Raja 100 100 - 100 - 100
Priya 200 300 100 - - -
Giri 100 -

Daily it will come upto 300 records. So for 100 days 300*100 records.How to store the records feasibly in database?How to define table to store records for above example?

View 2 Replies View Related

Can I Call A Procedure In One Database From A Procedure In Another?

Oct 5, 2007



Hi,
I have an integration solution that backs into two databases. Database A is custom and Database B is integrated from a COTS product. The manufacturer of B supplies a formal interface as stored procedures (and I intend to honor that contract by limiting my access to B through those stored procs).
Now, I have a search that is going to involve a subselect in the form of the following pseudocode:

select a,b from dbA.user.TableX where exists (select a from dbB.user.TableY)

I am trying to avoid creating 2 temporary cursors in the integration application and doing things in-memory (b/c of performance concerns).

So, my q is:
How can I make this happen within database A?

View 3 Replies View Related

Access To Result Set From System Call For Cluster Discrimination

Mar 11, 2008



I'm trying to use the result set from this kind of dmx query running in SQL Management Studio 2005:



CALL System.Microsoft.AnalysisServices.System.DataMining.Clustering.GetClusterDiscrimination('Clustering1','001','',0.0005,true)


However, I can't seem to get access to the data. For example, I get errors if I try something like


select into #ttt

CALL System.Microsoft.AnalysisServices.System.DataMining.Clustering.GetClusterDiscrimination('Clustering1','001','',0.0005,true)

where Attributes = 'Task Dur'


or



DECLARE @myTableVar TABLE (

myAttributes text,

myValues text,

myScore double

)

SET @myTableVar = CALL System.Microsoft.AnalysisServices.System.DataMining.Clustering.GetClusterDiscrimination('Clustering1','001','',0.0005,true)

select * from @myTableVar



Thanks for any pointers!

View 7 Replies View Related

How To Call Below Procedure

Apr 30, 2008

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 4/30/2008 2:25:41 PM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ostat_CDS_rpt47_2006]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ostat_CDS_rpt47_2006]
GO


/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 23/04/2008 11:26:14 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 22/04/2008 14:35:33 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 21/04/2008 11:46:08 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 16/04/2008 17:18:04 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 04/04/2008 12:44:34 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 31/03/2008 12:03:31 ******/

/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 31/03/2008 11:11:07 ******/


/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 09/03/2008 14:31:30 ******/
-- ostat_CDS_rpt47_2006 2008,03,17,17

CREATE procedure ostat_CDS_rpt47_2006
@pYear int,
@pMonth int,
@pDay1 int,
@pDay2 int

as
begin

declare @sql varchar(4000)
declare @tb1 varchar(128)
declare @tb2 varchar(128)

set @tb1= 'margin..ncds0421'
set @tb2='Report.dbo.ob_apr08'

set @sql=
'
insert into '+@tb2+'
select yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,0 isCallback,
cast(callcost as decimal (10,5)) cost,count(*) attempt,
sum(case when connectflg=1 then 1 else 0 end) connected,sum(talktime) Talktime
from '+@tb1+'
where yyyy='+ltrim(str(@pYear))+'
and mm='+ltrim(Str(@pMonth)) +'
and dd between '+ltrim(Str(@pDay1))+' and '+ltrim(Str(@pDay2))+'
and talktime >0 and trunkin is null
group by yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,cast(callcost as decimal (10,5))
order by yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,cast(callcost as decimal (10,5))
'
--print (@sql)
exec (@sql)

end









GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

View 2 Replies View Related

Store Procedure Not Store

Nov 20, 2013

My store Procedure is not save in Strore Procedure folder at the time of saving it give me option to save in Project folder and file name default is SQLQuery6.sql when i save it after saving when i run my store procedure

exec [dbo].[SP_GetOrdersForCustomer] 'ALFKI'

I am getting below error :

Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure 'dbo.SP_GetOrdersForCustomer'.

View 13 Replies View Related

How To Call A Stored Procedure Using C#

Aug 29, 2007

I have a stored procedure I created in SQL server 2005. Now I need to call the stored procedure in C#. Can someone help me out here? What is the C# code I need to call this stored procedure? I have never done this before and need some help.
CREATE PROCEDURE [dbo].[MarketCreate]
(  @MarketCode  nvarchar(20),  @MarketName  nvarchar(100),  @LastUpdateDate  nvarchar(2),)
ASINSERT INTO Market(  MarketCode  MarketName  LastUpdateDate)VALUES(  @MarketCode  @MarketName  @LastUpdateDate
)

View 5 Replies View Related

Want To Call Procedure From VS 2005

Apr 26, 2008

dear all
 i am using VS 2005 and sqlserver 2005....
 i created one procedure [dbo].[Rptdailyactivity_jul](@cond Varchar(8000), @Type varchar(100),@groupname4fsumm varchar(100) ,@Fromdate4fsumm datetime, @todate4fsumm datetime)
i want to call this procedure from VS how???
i tried based on the following code...
usig the following code i can able to manipulate tables...but how i can able to call procedure based on this code??and how i will pass parameters???
      ************
          Dim Conomandb As New System.Data.SqlClient.SqlConnection("Data Source=HJIOertsv;Initial Catalog=tr;Integrated Security=True")            If Conomandb.State = 1 Then Conomandb.Close()            Conomandb.Open()
            Dim Comomandb1 As New System.Data.SqlClient.SqlCommand(strSQL, Conomandb)            Dim rsOman1 As System.Data.SqlClient.SqlDataReader = Comomandb1.ExecuteReader()
             If rsOman1.Read() Then                        fghghfghf
             End If            Comomandb1.Cancel()            Comomandb1.Dispose()            rsOman1.Close()            ''*********************

View 4 Replies View Related

How To Call A Stored Procedure In Asp.net

Mar 31, 2006

I have created a stored procedure only with an insert statement in sql server 2005.
How can i call this stored procedure through code in ASP.NET page using vb.
i want to pass one parameter that comes from a text box in asp.net page.
my emailid is: g12garg@yahoo.co.in pls reply.
Thank you
Gaurav

View 2 Replies View Related

Call For BCP Within A Stored Procedure

Aug 7, 2001

Does anyone give me syntax for adding a bcp script within a stored procedure..I had done it once 3 yrs back does'nt seem to work now, and I do not know where I am going wrong??
Thanks

View 2 Replies View Related

How Can I Use Stored Procedure To Call Dll

Aug 7, 2001

Hi, If I have a dll file and I know the interface of that dll file. How can I use stored procedure to call this dll file? Thank you.

View 1 Replies View Related

How Can I Use Stored Procedure To Call Dll

Aug 7, 2001

Hi, If I have a dll file and I know the interface of that dll file. How can I use stored procedure to call this dll file? Thank you.

View 2 Replies View Related

Remote Procedure Call

Jul 25, 2002

I have a SQL2000(sp2) database (ServerA) and a SQL7(sp2) database(ServerB)
From the SQL2000 database I want to call a remote stored procedure on ServerB and store the result set in a table on ServerB.

E,g

insert TableA
exec ServerB...sp_GetStuff

If I try this by making serverB a remote server,
I get the following error message
Server: Msg 18456, Level 14, State 1, Line 1
Login failed for user 'sa'.
If I make ServerB a Linked server, I get the error
Server: Msg 8501, Level 16, State 1, Line 1
MSDTC on server '' is unavailable.
Server: Msg 7391, Level 16, State 1, Line 1
The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.

Now the MSDTC on ServerB won't start - It returns error 3221229574 to which the solution seems to be to reinstall MSDTC which looks like a very messy job with registry hacks and also the threat of reformatting the hard drive So I don't want to do this if possible

I really don't want a distibuted transaction anyway so I tried to stop the transaction being promoted using
SET REMOTE_PROC_TRANSACTIONS OFF

But this has no effect

Any ideas would be appreciated"

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved