Showing posts with label message. Show all posts
Showing posts with label message. Show all posts

Friday, March 30, 2012

Import of MSDTC transaction failed

Error: 8509, State: 1, Message: Import of MSDTC transaction failed: Result
Code = 0x8004d00e
I can not find any help on many websites.
How to do it?
The error message says that SQL Server can not enlist in the transaction
that is provide because the transaction is already implicitly or explicitly
committed or aborted.
Which OS are you on? If you are using Windows XP or Windows Server 2003 you
can use DTC trace to find out why the transaction import failed. If you do
not have this OS, you could use AppMetrics from ExtermeSoft see
http://www.xtremesoft.com
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2004 All rights reserved.
"lv mingtong" <lmt@.taeco.com.discuss> wrote in message
news:eUww2DIlEHA.1644@.tk2msftngp13.phx.gbl...
> Error: 8509, State: 1, Message: Import of MSDTC transaction failed: Result
> Code = 0x8004d00e
> I can not find any help on many websites.
> How to do it?
>
|||I too am having this issue. The db is running on Win XP Professional,
SQL Server 2K + ASP.NET app. It is an intermittent issue and occurs
every 4th hit to any page. I am using
System.EnterpriseServices.AutoCompleteAttribute(Tr ue) to auto commit
the transaction. The strange thing is that if I hit the maching
remotely it is fine...If I do it locally the error will appear.
Eg.
Scenario #1: Works and is fine:
Machine A = Web App, dll's etc
Machine B = DB server
Scenario #2: Generates the error "Import of MSDTC transaction failed:
Result Code = 0x8004d00e."
Machine A = Web App, dll's etc + DB server
It is a strange issue that is not constant.
Any suggestions will be attempted...no matter how bizzare
Thanks
|||I too am having this issue. The db is running on Win XP Professional,
SQL Server 2K + ASP.NET app. It is an intermittent issue and occurs
every 4th hit to any page. I am using
System.EnterpriseServices.AutoCompleteAttribute(Tr ue) to auto commit
the transaction. The strange thing is that if I hit the maching
remotely it is fine...If I do it locally the error will appear.
Eg.
Scenario #1: Works and is fine:
Machine A = Web App, dll's etc
Machine B = DB server
Scenario #2: Generates the error "Import of MSDTC transaction failed:
Result Code = 0x8004d00e."
Machine A = Web App, dll's etc + DB server
It is a strange issue that is not constant.
Any suggestions will be attempted...no matter how bizzare
Thanks
sql

Import of MSDTC transaction failed

Error: 8509, State: 1, Message: Import of MSDTC transaction failed: Result
Code = 0x8004d00e
I can not find any help on many websites.
How to do it?The error message says that SQL Server can not enlist in the transaction
that is provide because the transaction is already implicitly or explicitly
committed or aborted.
Which OS are you on? If you are using Windows XP or Windows Server 2003 you
can use DTC trace to find out why the transaction import failed. If you do
not have this OS, you could use AppMetrics from ExtermeSoft see
http://www.xtremesoft.com
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright © SQLDev.Net 1991-2004 All rights reserved.
"lv mingtong" <lmt@.taeco.com.discuss> wrote in message
news:eUww2DIlEHA.1644@.tk2msftngp13.phx.gbl...
> Error: 8509, State: 1, Message: Import of MSDTC transaction failed: Result
> Code = 0x8004d00e
> I can not find any help on many websites.
> How to do it?
>|||I too am having this issue. The db is running on Win XP Professional,
SQL Server 2K + ASP.NET app. It is an intermittent issue and occurs
every 4th hit to any page. I am using
System.EnterpriseServices.AutoCompleteAttribute(True) to auto commit
the transaction. The strange thing is that if I hit the maching
remotely it is fine...If I do it locally the error will appear.
Eg.
Scenario #1: Works and is fine:
Machine A = Web App, dll's etc
Machine B = DB server
Scenario #2: Generates the error "Import of MSDTC transaction failed:
Result Code = 0x8004d00e."
Machine A = Web App, dll's etc + DB server
It is a strange issue that is not constant.
Any suggestions will be attempted...no matter how bizzare :)
Thanks|||I too am having this issue. The db is running on Win XP Professional,
SQL Server 2K + ASP.NET app. It is an intermittent issue and occurs
every 4th hit to any page. I am using
System.EnterpriseServices.AutoCompleteAttribute(True) to auto commit
the transaction. The strange thing is that if I hit the maching
remotely it is fine...If I do it locally the error will appear.
Eg.
Scenario #1: Works and is fine:
Machine A = Web App, dll's etc
Machine B = DB server
Scenario #2: Generates the error "Import of MSDTC transaction failed:
Result Code = 0x8004d00e."
Machine A = Web App, dll's etc + DB server
It is a strange issue that is not constant.
Any suggestions will be attempted...no matter how bizzare :)
Thanks

Monday, March 26, 2012

import html file error

Im trying to import an html file using dts. When I click on the file when
using dts designer, I get the message:
External table is not in the expected format.
Any ideas?
--
SQL2K SP3
TIA, ChrisRIn message <udOcQh54EHA.936@.TK2MSFTNGP12.phx.gbl>, ChrisR
<bla@.noemail.com> writes
>Im trying to import an html file using dts. When I click on the file when
>using dts designer, I get the message:
>External table is not in the expected format.
>Any ideas?
>--
>SQL2K SP3
>TIA, ChrisR
>
Does the error not say it all? The HTML connection cannot
parse/recognise a valid html table in that file. No table, no import.
--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com
PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org

import from file

Hello every body.
I' m a guy from spain and this is my first message, and like you are going to check my english is not very good.
I have a problem with T-Sql in the SQL server 7.
I have to import data from files several times a day.
i'm trying to use de Bulk Insert command but i have problems with the variable witch contain the name of file:

set @.file = 'c:\pruebas\lw' + char(@.last + 1) + '.dat'
Bulk insert tbl_Latewar from @.file with ( fieldterminator = ' ' , firstrow = 1 , lastrow = 1 )

it gives me a 170 error.
if you know another command to do this, please tell me.

if would help me i'll be very gratefully.
Thanks in advance.That error means there is a syntax probem.

Have you tried the same command but with the file name inserted instead of a variable ?

Wednesday, March 21, 2012

import excel

need some help with getting this stored procedure working.
I'm trying to import excel spreadsheet into an existing table
getting error message of syntax near "*"
===========================================
CREATE PROCEDURE [dbo].importExcel
AS
--Create linked server
EXEC sp_addlinkedserver 'ExcelSource', 'Jet
4.0','Microsoft.Jet.OLEDB.4.0','C:\temp\tables.xls ', NULL,'Excel 5.0'
GO
--login to linked server
EXEC sp_addlinkedsrvlogin 'ExcelSource', 'false', 'sa', 'Admin', NULL
GO
-- import spreadsheet data into database table...
SET ANSI_NULLS ON
GO
SET ANSI_WARNINGS ON
GO
DECLARE @.SQLString1 VARCHAR(100)
SET @.SQLString1 = 'SELECT * FROM ExcelSource...[table$]'
DECLARE @.SQLString2 VARCHAR(100)
SET @.SQLString2 = 'INSERT INTO table ' + @.SQLString1
-- convert variable from VARCHAR to NVARCHAR
DECLARE @.S2 NVARCHAR(1000)
SET @.S2 = CAST(@.SQLString2 as NVarchar(1000))
EXECUTE sp_executesql @.S2
GO
EXEC sp_dropserver 'ExcelSource', 'droplogins'
GO
hi,
"TJS" <nospam@.here.com> ha scritto nel messaggio
news:10qlms38norp6e3@.corp.supernews.com
> need some help with getting this stored procedure working.
> I'm trying to import excel spreadsheet into an existing table
> getting error message of syntax near "*"
> SET @.SQLString1 = 'SELECT * FROM ExcelSource...[table$]'
what is the name of the Excel sheet?
usually it defaults to Sheet1$, so the correct syntax is
SET @.SQLString1 = 'SELECT * FROM ExcelSource...[Sheet1$]'
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||the name is correct , I am only testing at this time.
I did remove the extra GO statements and that seems to have resolved the
error messages.
I now have to find an ASP file to dynamically generate the sql statements
for each spreadsheet table and pass them into the stored procedure because
the live database tables have primary keys. That unfortunately requires
using column lists...
I can't believe somebody hasn't already done all this ?
sql

Import e-mails into SQL Server database

This is a multi-part message in MIME format.
--=_NextPart_000_000C_01C513AD.9261A570
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I need to import/extract information from E-mails delivered to my SQL = Server 2000 mail account.
The format of the e-mail is as below
ALERT for FPC \ fujipoc_FPC_01 \ R3Syslog \ CCMS at 20040916 074903 ( = Time in UTC ) Yellow CCMS alert for monitored object CCMS Alert Text:The = active profile was modified System:FPC
Segment:SAP_CCMS_fujipoc_FPC_01
MTE:FPC\fujipoc_FPC_01\R3Syslog\CCMS
Client:000
User:SAPSYS
The information I want to capture is underlined, the text file is not = standard in width as there are many different monitors.
Is there an easy way to pull this information into the SQL table, I know = that I can use format files with BCP but what about DTS packages?
TIA
Chris aka BoobBoo
--=_NextPart_000_000C_01C513AD.9261A570
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
Hi,I need to import/extract information from E-mails delivered to my SQL Server 2000 = mail account.The format of the e-mail is as belowALERT for = FPC \ fujipoc_FPC_01 \ R3Syslog \ CCMS at 20040916 074903 ( Time = in UTC ) Yellow CCMS alert for monitored object CCMS Alert Text:The = active profile was modified System:FPCSegment:SAP_CCMS_fujipoc_FPC_01MTE:FPC\fujipoc_F= PC_01\R3Syslog\CCMSClient:000User:SAPSYSThe information I want to capture is underlined, the text file is not = standard in width as there are many different monitors.Is there an easy way = to pull this information into the SQL table, I know that I can use format files = with BCP but what about DTS packages?TIA Chris aka BoobBoo
--=_NextPart_000_000C_01C513AD.9261A570--Hi
You may want to look at xp_findnextmsg and xp_readmail to read the mailbox
directly. You can then use string functions to parse the message.
John
"Chris Kernaghan" wrote:
> Hi,
> I need to import/extract information from E-mails delivered to my SQL Server 2000 mail account.
> The format of the e-mail is as below
> ALERT for FPC \ fujipoc_FPC_01 \ R3Syslog \ CCMS at 20040916 074903 ( Time in UTC ) Yellow CCMS alert for monitored object CCMS Alert Text:The active profile was modified System:FPC
> Segment:SAP_CCMS_fujipoc_FPC_01
> MTE:FPC\fujipoc_FPC_01\R3Syslog\CCMS
> Client:000
> User:SAPSYS
>
> The information I want to capture is underlined, the text file is not standard in width as there are many different monitors.
> Is there an easy way to pull this information into the SQL table, I know that I can use format files with BCP but what about DTS packages?
>
> TIA
> Chris aka BoobBoo

Monday, March 12, 2012

import data from excel sheet to sql server

i am using an OPENROWSET method to import from excel data to sql server. i a
m getting an error like
ADO error:[OLE/DB provider returned message: Operation wa canceled.]
OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBInitializ
Initialize returned 0x80040e4e
Could not initialize data source object of OLE DB provider "MSDASQL'.
Deferred prepare could not be completed
i want to reinstall the OLE DB Driver.can anyone tell me the exact link to d
owload the OLE DB driver.
From http://www.developmentnow.com/g/100...ver-connect.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.comThe provider is installed with MDAC. You can download MDAC
versions and also download component checker to check the
MDAC version from:
http://msdn.microsoft.com/data/ref/mdac/downloads/
The exact link depends on which version you want to
reinstall.
-Sue
On Tue, 01 Aug 2006 10:19:53 GMT, shybi<ajesh@.k.st> wrote:

>i am using an OPENROWSET method to import from excel data to sql server. i
am getting an error like
>ADO error:[OLE/DB provider returned message: Operation wa canceled.]
>OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBInitializ
>Initialize returned 0x80040e4e
>Could not initialize data source object of OLE DB provider "MSDASQL'.
>Deferred prepare could not be completed
>i want to reinstall the OLE DB Driver.can anyone tell me the exact link to
dowload the OLE DB driver.
>From http://www.developmentnow.com/g/100...elopmentnow.com|||I think you want to be using a different provider instead of "MSDASQL."
Try: Microsoft.Jet.OLEDB.4.0
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"shybi" <ajesh@.k.st> wrote in message
news:13b25c23-b877-4ac8-92dd-2d242c204a77@.developmentnow.com...
>i am using an OPENROWSET method to import from excel data to sql server. i
>am getting an error like
> ADO error:[OLE/DB provider returned message: Operation wa canceled.]
> OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBInitializ
> Initialize returned 0x80040e4e
> Could not initialize data source object of OLE DB provider "MSDASQL'.
> Deferred prepare could not be completed
> i want to reinstall the OLE DB Driver.can anyone tell me the exact link to
> dowload the OLE DB driver.
> From
> http://www.developmentnow.com/g/100...ver-connect.htm
> Posted via DevelopmentNow.com Groups
> http://www.developmentnow.com

Wednesday, March 7, 2012

import csv file to sql

Hi guys

i am trying to import a csv file into the sql, but my problem is that I have a message in one of the columns. suggestions

- Executing (Error)

Messages

Error 0xc02020a1: Data Flow Task: Data conversion failed. The data conversion for column "INTVAL" returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
(SQL Server Import and Export Wizard)

Error 0xc0209029: Data Flow Task: The "output column "INTVAL" (22)" failed because error code 0xC0209084 occurred, and the error row disposition on "output column "INTVAL" (22)" specifies failure on error. An error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)

Error 0xc0202092: Data Flow Task: An error occurred while processing file "E:\minessight\blastinfoattrib.csv" on data row 2.
(SQL Server Import and Export Wizard)

Error 0xc0047038: Data Flow Task: The PrimeOutput method on component "Source - blastinfoattrib_csv" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
(SQL Server Import and Export Wizard)

Error 0xc0047021: Data Flow Task: Thread "SourceThread0" has exited with error code 0xC0047038.
(SQL Server Import and Export Wizard)

Error 0xc0047039: Data Flow Task: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.
(SQL Server Import and Export Wizard)

Error 0xc0047021: Data Flow Task: Thread "WorkThread0" has exited with error code 0xC0047039.
(SQL Server Import and Export Wizard)

It appears that the data that was to be imported into the IntVal column is too big for the datatype of the column.

If you were to post the table DDL, we may be able to provide better help.

|||

Hi,

The script which has the DDL is as shown below;

Code Snippet

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GEOMSEGMENTVFD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GEOMSEGMENTVFD]
GO
CREATE TABLE [dbo].[GEOMSEGMENTVFD] (
[OBJECTID] [varchar] (50) NOT NULL ,
[SEGMENTID] [varchar] (50) NOT NULL ,
[VFNAME] [varchar] (50) NOT NULL ,
[TEXTVAL] [varchar] (50) NULL ,
[INTVAL] [int] NULL ,
[DBLVAL] [float] NULL ,
[BLBVAL] [image] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[GEOMSEGMENTVFD] WITH NOCHECK ADD
CONSTRAINT [PRIMARYKEYGEOMSEGMENTVFD] PRIMARY KEY CLUSTERED
(
[OBJECTID],
[SEGMENTID],
[VFNAME]
) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
ALTER TABLE [dbo].[GEOMSEGMENTVFD] WITH NOCHECK ADD
CONSTRAINT FK_GEOMSEGMENTVFD_GEOMSEGMENT
FOREIGN KEY (OBJECTID,SEGMENTID)
REFERENCES [dbo].[GEOMSEGMENT] (OBJECTID,SEGMENTID)
ON DELETE CASCADE
ON UPDATE CASCADE

GO
ALTER TABLE [dbo].[GEOMSEGMENTVFD] WITH NOCHECK ADD
CONSTRAINT FK_GEOMSEGMENTVFD_GEOMVF
FOREIGN KEY (VFNAME)
REFERENCES [dbo].[GEOMVF] (VFNAME)
ON DELETE CASCADE
ON UPDATE CASCADE

GO

Thanks

|||

The next task is to verify that in the import data (csv file), the values to be transferred to the IntVal column are NOT outside the range of:

-2,147,483,648 through 2,147,483,647

If you find data that falls outside that range, you will have to either: correct the import data to be within that range, OR, change the IntVal datatype in the table to be a [bigint] datatype.

Import Charts

Hello NG!
I want to import AccessXP reports with charts. Is there any possibility to do this?
In the report designer error message callt object is not supportet.
Michael HerrmannsBOL contains a topic on the supported access report features during import:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSCREATE/htm/rcr_creating_building_v1_5x2r.asp
At the end of the "report controls" section it states: "For example, if an
Access report contains an OWC Chart control, it will not be converted when
the report is imported. The control must be added manually after the report
is imported." I.e. you have to re-create the charts with the Reporting
Services chart control.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Michael Herrmanns" <m.herrmanns@.fme.de> wrote in message
news:8c74690.0409130133.48f12c8b@.posting.google.com...
> Hello NG!
> I want to import AccessXP reports with charts. Is there any possibility to
do this?
> In the report designer error message callt object is not supportet.
> Michael Herrmanns|||Thanks Roberts.
Next time I better rtm.
greeting
Michael

Sunday, February 19, 2012

Implicit conversion from string to date

Hello,
I am getting the message Implicit conversion from string to date...
Please help
Protected Sub btnShowDetails_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles btnShowDetails.Click
Dim startdate As String = txtStartDate.Text
Dim enddate As String = txtEndDate.Text
'startdate = Convert.ToDateTime(startdate as date)
GRCallHistory.DataSource = getcallhistory("PhoneNumber",
"StartDate", "EndDate")
GRCallHistory.DataBind()
End Sub
Function getcallhistory(ByVal Phonenumber As String, _
ByVal StartDate As DateTime, _
ByVal enddate As DateTime) As
System.Data.SqlClient.SqlDataReader
Dim Connectionstring As String =
"Server=192.168.225. 8;Database=Wiband;uid=Wiband;password=op
tiplex"
Dim sqlConnection As System.Data.SqlClient.SqlConnection = New
System.Data.SqlClient.SqlConnection(Connectionstring)
Dim querystring As String = "select SUBSTRING(CAST(calldate AS
VARCHAR(20)), 1, 11) AS CallDate, SUBSTRING(CAST(calldate AS
VARCHAR(20)), 12, 13) AS CallTime, PhoneNumber, minutes,
calldescription, charge from
voipcalls.dbo.fw_fnVOIPGetCustCallHistory('" & Phonenumber & "', '" &
StartDate & "', '" & enddate & "', 0, -1)"
Dim sqlCommand As System.Data.SqlClient.SqlCommand = New
System.Data.SqlClient.SqlCommand(querystring, sqlConnection)
sqlConnection.Open()
Dim dataReader As System.Data.SqlClient.SqlDataReader =
sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Return dataReader
End FunctionWell, what does the string you are trying to cast look like? You can't
expect people here to take your .NET code, build an application, and make
assumptions about what is actually being passed into values for StartDate
and EndDate. Heck, a lot of people here don't even have .NET installed.
So, please try to demonstrate what you're trying to convert to a DATETIME
with something a little more direct, e.g.
SELECT CONVERT(DATETIME, 'some string')
A
<lizansi@.gmail.com> wrote in message
news:1127400225.270131.95980@.g49g2000cwa.googlegroups.com...
> Hello,
> I am getting the message Implicit conversion from string to date...
> Please help
> Protected Sub btnShowDetails_Click(ByVal sender As Object, ByVal e As
> EventArgs) Handles btnShowDetails.Click
> Dim startdate As String = txtStartDate.Text
> Dim enddate As String = txtEndDate.Text
> 'startdate = Convert.ToDateTime(startdate as date)
>
> GRCallHistory.DataSource = getcallhistory("PhoneNumber",
> "StartDate", "EndDate")
> GRCallHistory.DataBind()
> End Sub
> Function getcallhistory(ByVal Phonenumber As String, _
> ByVal StartDate As DateTime, _
> ByVal enddate As DateTime) As
> System.Data.SqlClient.SqlDataReader
> Dim Connectionstring As String =
> "Server=192.168.225. 8;Database=Wiband;uid=Wiband;password=op
tiplex"
> Dim sqlConnection As System.Data.SqlClient.SqlConnection = New
> System.Data.SqlClient.SqlConnection(Connectionstring)
> Dim querystring As String = "select SUBSTRING(CAST(calldate AS
> VARCHAR(20)), 1, 11) AS CallDate, SUBSTRING(CAST(calldate AS
> VARCHAR(20)), 12, 13) AS CallTime, PhoneNumber, minutes,
> calldescription, charge from
> voipcalls.dbo.fw_fnVOIPGetCustCallHistory('" & Phonenumber & "', '" &
> StartDate & "', '" & enddate & "', 0, -1)"
> Dim sqlCommand As System.Data.SqlClient.SqlCommand = New
> System.Data.SqlClient.SqlCommand(querystring, sqlConnection)
> sqlConnection.Open()
> Dim dataReader As System.Data.SqlClient.SqlDataReader =
> sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
> Return dataReader
> End Function
>|||I hope your SQL server sits behind a DMZ (for your sake)
Anyway the problem is here
dbo.fw_fnVOIPGetCustCallHistory('" & Phonenumber & "', '" &
StartDate & "', '" & enddate & "', 0, -1)"
StartDate and enddate are not formatted well
http://sqlservercode.blogspot.com/
"lizansi@.gmail.com" wrote:

> Hello,
> I am getting the message Implicit conversion from string to date...
> Please help
> Protected Sub btnShowDetails_Click(ByVal sender As Object, ByVal e As
> EventArgs) Handles btnShowDetails.Click
> Dim startdate As String = txtStartDate.Text
> Dim enddate As String = txtEndDate.Text
> 'startdate = Convert.ToDateTime(startdate as date)
>
> GRCallHistory.DataSource = getcallhistory("PhoneNumber",
> "StartDate", "EndDate")
> GRCallHistory.DataBind()
> End Sub
> Function getcallhistory(ByVal Phonenumber As String, _
> ByVal StartDate As DateTime, _
> ByVal enddate As DateTime) As
> System.Data.SqlClient.SqlDataReader
> Dim Connectionstring As String =
> "Server=192.168.225. 8;Database=Wiband;uid=Wiband;password=op
tiplex"
> Dim sqlConnection As System.Data.SqlClient.SqlConnection = New
> System.Data.SqlClient.SqlConnection(Connectionstring)
> Dim querystring As String = "select SUBSTRING(CAST(calldate AS
> VARCHAR(20)), 1, 11) AS CallDate, SUBSTRING(CAST(calldate AS
> VARCHAR(20)), 12, 13) AS CallTime, PhoneNumber, minutes,
> calldescription, charge from
> voipcalls.dbo.fw_fnVOIPGetCustCallHistory('" & Phonenumber & "', '" &
> StartDate & "', '" & enddate & "', 0, -1)"
> Dim sqlCommand As System.Data.SqlClient.SqlCommand = New
> System.Data.SqlClient.SqlCommand(querystring, sqlConnection)
> sqlConnection.Open()
> Dim dataReader As System.Data.SqlClient.SqlDataReader =
> sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
> Return dataReader
> End Function
>|||sorry aaron, this was the first time i ever joined google
group...basically it's taking two arguments from a text box that is
startdate and enddate and pass it to the sql function. this function
has both the parameters as datetime.|||Yes, I understand how the program works. Now show some example input from
the text box. And do whatyou can to standardize this, e.g. have them pick
from a calendar and build the date for them. If you allow them free text
entry, they're going to enter all kinds of invalid crap. What date is
05/06/04? Is that May 6th 2004, or June 5th 2004, or April 6th 2005? How
about 05/13/03? And 7/5/2006? 04/13/13?
<lizansi@.gmail.com> wrote in message
news:1127401135.824457.280650@.g43g2000cwa.googlegroups.com...
> sorry aaron, this was the first time i ever joined google
> group...basically it's taking two arguments from a text box that is
> startdate and enddate and pass it to the sql function. this function
> has both the parameters as datetime.
>|||aaron, I have people input the date in format 08/01/2005...this is
mandatory|||Okay, so show an actual value that fails!
<lizansi@.gmail.com> wrote in message
news:1127403625.223935.182810@.g43g2000cwa.googlegroups.com...
> aaron, I have people input the date in format 08/01/2005...this is
> mandatory
>|||select SUBSTRING(CAST (calldate AS VARCHAR(20)), 1, 11) AS CallDate,
SUBSTRING(CAST(calldate AS VARCHAR(20)), 12, 13) AS CallTime,
PhoneNumber, minutes, calldescription, charge
from voipcalls.dbo. fw_fnVOIPGetCustCallHistory('2549462784'
,
'08/01/2005', '09/21/2005', 0, -1)|||What is fw_fnVOIPGetCustCallHistory ? Can you give enough DDL and sample
data so that we can at least try to understand WHERE the conversion is
failing?
<lizansi@.gmail.com> wrote in message
news:1127404442.502836.42140@.g14g2000cwa.googlegroups.com...
> select SUBSTRING(CAST (calldate AS VARCHAR(20)), 1, 11) AS CallDate,
> SUBSTRING(CAST(calldate AS VARCHAR(20)), 12, 13) AS CallTime,
> PhoneNumber, minutes, calldescription, charge
> from voipcalls.dbo. fw_fnVOIPGetCustCallHistory('2549462784'
,
> '08/01/2005', '09/21/2005', 0, -1)
>|||fw_fnVOIPGetCustCallHistory is a function that returns a table with the
info of phone.
here's the function:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
Function dbo.fw_fnVOIPGetCustCallHistory
(
@.PhoneNumber as VarChar(80),
@.StartDate DateTime,
@.EndDate DateTime,
@.Direction Int,
@.Billable Int
)
RETURNS @.CDR TABLE
(
uniqueid VarChar(32),
calldate DateTime,
PhoneNumber VarChar(80),
CallDescription Varchar(50),
Direction VarChar(20),
Minutes Int,
Charge Money,
Billable Bit
)
AS
Begin
Declare @.CDRWork TABLE
(
uniqueid VarChar(32),
calldate DateTime,
PhoneNumber VarChar(80),
L3 VarChar(3),
S42 VarChar(2),
S43 VarChar(3),
S44 VarChar(4),
CallDescription Varchar(50),
Direction VarChar(20),
Minutes Int,
BillRate Money Default 0,
Charge Money Default 0,
BillTypeID Int Default 0, --0=Non-Billable 1=PerMinute 2=PerCall
Billable Bit,
PhoneID Int,
Updated Bit Default 0
)
Set @.EndDate=DateAdd(d,1,@.EndDate)
If @.Direction in (-1,1)
Begin
Insert into @.CDRWork (uniqueid, PhoneNumber, Minutes, CallDate,
Direction)
select
uniqueid, dst as PhoneNumber, Ceiling(Cast(billsec as Decimal)/60)
as Minutes,
calldate, 'Outgoing' as Direction
from
cdr
Where
disposition='4' and billsec>0 and
src=@.PhoneNumber and
calldate>=@.StartDate and calldate<@.EndDate
End
If @.Direction in (-1,0)
Begin
Insert into @.CDRWork (uniqueid, PhoneNumber, Minutes, CallDate,
Direction, Charge, Billable)
select
uniqueid, src as PhoneNumber, Ceiling(Cast(billsec as Decimal)/60)
as Minutes,
calldate, 'Incoming' as Direction,
0 as Charge, 0 as Billable
from
cdr
Where
disposition='4' and billsec>0 and
dst=@.PhoneNumber and src<>@.PhoneNumber and
calldate>=@.StartDate and calldate<@.EndDate
End
---
Update @.CDRWork
Set
L3 =Left(PhoneNumber,3),
S42=Substring(PhoneNumber,4,2),
S43=Substring(PhoneNumber,4,3),
S44=Substring(PhoneNumber,4,4)
Where
Left(PhoneNumber,1)<>'1'
Update @.CDRWork
Set
L3 =Substring(PhoneNumber,2,3),
S42=Substring(PhoneNumber,5,2),
S43=Substring(PhoneNumber,5,3),
S44=Substring(PhoneNumber,5,4)
Where
Left(PhoneNumber,1)='1'
---
/*intl calls using 011 prefix and 2-digit country code*/
Update a
Set
a.Updated=1,
a.PhoneID=b.PhoneID,
a.CallDescription=Upper(Rtrim(b.Display)),
a.BillTypeID=
Case
When a.Direction='Outgoing' Then 1
Else 0
End,
a.Billable=
Case
When a.Direction='Outgoing' Then b.Billable
Else 0
End
From
@.CDRWork a, fw_PhoneKey b
where
a.L3= '011' and
b.CountryCode=a.S42
---
/*intl calls using 011 prefix and 3-digit country code*/
Update a
Set
a.Updated=1,
a.PhoneID=b.PhoneID,
a.CallDescription=Upper(Rtrim(b.Display)),
a.BillTypeID=
Case
When a.Direction='Outgoing' Then 1
Else 0
End,
a.Billable=
Case
When a.Direction='Outgoing' Then b.Billable
Else 0
End
From
@.CDRWork a, fw_PhoneKey b
where
a.Updated=0 and
a.L3= '011' and
b.CountryCode=a.S43
---
/*intl calls using 011 prefix and 4-digit country code*/
Update a
Set
a.Updated=1,
a.PhoneID=b.PhoneID,
a.CallDescription=Upper(Rtrim(b.Display)),
a.BillTypeID=
Case
When a.Direction='Outgoing' Then 1
Else 0
End,
a.Billable=
Case
When a.Direction='Outgoing' Then b.Billable
Else 0
End
From
@.CDRWork a, fw_PhoneKey b
where
a.Updated=0 and
a.L3= '011' and
b.CountryCode=a.S44
---
/*normal domestic calls*/
Update a
Set
a.Updated=1,
a.PhoneID=b.PhoneID,
a.CallDescription=Upper(Rtrim(b.Display)+' '+b.State),
a.BillTypeID=
Case
When a.Direction='Outgoing' and b.Billable=1 Then 1
Else 0
End,
a.Billable=
Case
When a.Direction='Outgoing' Then b.Billable
Else 0
End
From
@.CDRWork a, fw_PhoneKey b
where
a.Updated=0 and
a.L3 = b.npa and
a.S43 = b.nxx and
b.nxx not in ('411', '555', '611')
---
/*intl calls like Canada or Caribbean using area codes*/
Update a
Set
a.Updated=1,
a.PhoneID=b.PhoneID,
a.CallDescription=Upper(Rtrim(b.Display)),
a.BillTypeID=
Case
When a.Direction='Outgoing' Then 1
Else 0
End,
a.Billable=
Case
When a.Direction='Outgoing' Then b.Billable
Else 0
End
From
@.CDRWork a, fw_PhoneKey b
where
a.Updated=0 and
A.L3= b.npa and
b.billrate > 0 and
b.nxx is null
---
/*information calls (3-digit flavor)*/
Update a
Set
a.Updated=1,
a.PhoneID=b.PhoneID,
a.CallDescription=Upper(Rtrim(b.Display)),
a.BillTypeID=
Case
When a.Direction='Outgoing' Then 2
Else 0
End,
a.Billable=
Case
When a.Direction='Outgoing' Then b.Billable
Else 0
End
From
@.CDRWork a, fw_PhoneKey b
where
a.Updated=0 and
A.L3= b.nxx and
b.nxx in ('411','555','611')
---
/*information calls (10-digit flavor)*/
Update a
Set
a.Updated=1,
a.PhoneID=b.PhoneID,
a.CallDescription=Upper(Rtrim(b.Display)),
a.BillTypeID=
Case
When a.Direction='Outgoing' Then 2
Else 0
End,
a.Billable=
Case
When a.Direction='Outgoing' Then b.Billable
Else 0
End
From
@.CDRWork a, fw_PhoneKey b
where
a.Updated=0 and
A.S43= b.nxx and
b.nxx in ('411','555', '611') and
a.L3 = b.npa
---
/*Calls not locatable in fw_PhoneKey*/
Update @.CDRWork
Set
CallDescription='UNKNOWN',
Charge=0,
BillTypeID=0,
Billable=0
Where
Updated=0
---
If @.Billable<>-1
Begin
Delete from @.CDRWork where Billable<>@.Billable
End
---
Update @.CDRWork set BillRate=dbo.fw_fnVOIPGetPhoneCallRate(PhoneID,
CallDate)
where Direction='Outgoing' and Billable=1
Update @.CDRWork set Charge=BillRate Where BillTypeID=2 --Per Call
Update @.CDRWork set Charge=Cast(Minutes as Money) * BillRate Where
BillTypeID=1 --Per Minute
---
Insert into @.CDR
(
uniqueid,
calldate,
PhoneNumber,
CallDescription,
Minutes,
Direction,
Charge,
Billable
)
Select
uniqueid,
calldate,
PhoneNumber,
CallDescription,
Minutes,
Direction,
Charge,
Billable
From @.CDRWork
Order By CallDate Desc
Return
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
When I run this sql query in query analyzer, it runs fine, gives me the
correct results. But when I call it from asp.net webpage, it faild.