Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Wednesday, March 7, 2012

Import Column HELP!!

I have expended all my energy on "Import Column" Can someone please tell me how to properly configure the object. The documentation at MSDN is clear as MUD, see http://msdn2.microsoft.com/en-us/library/ms141262.aspx. No examples and everything I try generates a verification error.

I have a table named GifFiles:
GifFileName varchar(250),
GifFile IMAGE

All I want to do is process each record and read the file in GifFileName into GifFile. Import Column SAYS it does that.

Thank youUmm, what is the error exactly?|||Thanks for the reply.

I found the problem. Hidden in the "Input Columns" deep down at the bottom of properties is the "FileDataColumnID" which I needed to set to the Output var, I created.

This is NOT intuitive and not documented anywhere in MS that I can find. As well as, why isn't there a drop down list of output vars to select instead of remembering the ID. And while I am at it, why is it on the INPUT instead of the OUTPUT, which I MUST CREATE. It would make more sense to have the Output Var point to an Input Column. End of rant.

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

Friday, February 24, 2012

import an excel file

I tried to import an excel file using import/export wizard. When I launch
it, it gives me an error:
The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
and registered. The wizard cannot continue and will terminate.
Additional Information:
Unable to cast COM object of type ...
Can anyone please tell me how to fix this? Thanks.
Hi
You should find dts.dll in C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll
Run this with the /u flag will unload the dll if necessary.
If you are not using SP1 you may want to load this to see if the problem is
resolved. If this does not cure the issue please post error numbers and the
full error message and any information from the event log as well.
HTH
John
"00KobeBrian" wrote:

> I tried to import an excel file using import/export wizard. When I launch
> it, it gives me an error:
> The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
> and registered. The wizard cannot continue and will terminate.
> Additional Information:
> Unable to cast COM object of type ...
>
> Can anyone please tell me how to fix this? Thanks.
>
>
|||Just want to clarify.
So do you want me to run regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll /u
Then run regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
and see if it works?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...[vbcol=seagreen]
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
|||I got it now. Thanks.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...[vbcol=seagreen]
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
|||Hi
Does this mean it is working?
Running regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
whilst it is registered would not cause any problems, but it is a good idea
to try and unregister it first.
John
"00KobeBrian" wrote:

> I got it now. Thanks.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
>
>

import an excel file

I tried to import an excel file using import/export wizard. When I launch
it, it gives me an error:
The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
and registered. The wizard cannot continue and will terminate.
Additional Information:
Unable to cast COM object of type ...
Can anyone please tell me how to fix this? Thanks.Hi
You should find dts.dll in C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll
Run this with the /u flag will unload the dll if necessary.
If you are not using SP1 you may want to load this to see if the problem is
resolved. If this does not cure the issue please post error numbers and the
full error message and any information from the event log as well.
HTH
John
"00KobeBrian" wrote:

> I tried to import an excel file using import/export wizard. When I launch
> it, it gives me an error:
> The SSIS Runtime object could not be created. Verify that DTS.dll is avaib
le
> and registered. The wizard cannot continue and will terminate.
> Additional Information:
> Unable to cast COM object of type ...
>
> Can anyone please tell me how to fix this? Thanks.
>
>|||Just want to clarify.
So do you want me to run regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll /u
Then run regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
and see if it works?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...[vbcol=seagreen]
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
>|||I got it now. Thanks.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...[vbcol=seagreen]
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
>|||Hi
Does this mean it is working?
Running regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
whilst it is registered would not cause any problems, but it is a good idea
to try and unregister it first.
John
"00KobeBrian" wrote:

> I got it now. Thanks.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
>
>

import an excel file

I tried to import an excel file using import/export wizard. When I launch
it, it gives me an error:
The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
and registered. The wizard cannot continue and will terminate.
Additional Information:
Unable to cast COM object of type ...
Can anyone please tell me how to fix this? Thanks.Hi
You should find dts.dll in C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll
Run this with the /u flag will unload the dll if necessary.
If you are not using SP1 you may want to load this to see if the problem is
resolved. If this does not cure the issue please post error numbers and the
full error message and any information from the event log as well.
HTH
John
"00KobeBrian" wrote:
> I tried to import an excel file using import/export wizard. When I launch
> it, it gives me an error:
> The SSIS Runtime object could not be created. Verify that DTS.dll is avaible
> and registered. The wizard cannot continue and will terminate.
> Additional Information:
> Unable to cast COM object of type ...
>
> Can anyone please tell me how to fix this? Thanks.
>
>|||Just want to clarify.
So do you want me to run regsvr32 C:\Program Files\Microsoft SQL
Server\90\DTS\Binn\DTS.dll /u
Then run regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
and see if it works?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
>> I tried to import an excel file using import/export wizard. When I launch
>> it, it gives me an error:
>> The SSIS Runtime object could not be created. Verify that DTS.dll is
>> avaible
>> and registered. The wizard cannot continue and will terminate.
>> Additional Information:
>> Unable to cast COM object of type ...
>>
>> Can anyone please tell me how to fix this? Thanks.
>>|||I got it now. Thanks.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
> Hi
> You should find dts.dll in C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> Server\90\DTS\Binn\DTS.dll
> Run this with the /u flag will unload the dll if necessary.
> If you are not using SP1 you may want to load this to see if the problem
> is
> resolved. If this does not cure the issue please post error numbers and
> the
> full error message and any information from the event log as well.
> HTH
> John
> "00KobeBrian" wrote:
>> I tried to import an excel file using import/export wizard. When I launch
>> it, it gives me an error:
>> The SSIS Runtime object could not be created. Verify that DTS.dll is
>> avaible
>> and registered. The wizard cannot continue and will terminate.
>> Additional Information:
>> Unable to cast COM object of type ...
>>
>> Can anyone please tell me how to fix this? Thanks.
>>|||Hi
Does this mean it is working?
Running regsvr32 C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTS.dll
whilst it is registered would not cause any problems, but it is a good idea
to try and unregister it first.
John
"00KobeBrian" wrote:
> I got it now. Thanks.
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:D0926A82-FDA8-467A-A56A-6DC1FBE3CE21@.microsoft.com...
> > Hi
> >
> > You should find dts.dll in C:\Program Files\Microsoft SQL
> > Server\90\DTS\Binn\DTS.dll. You could try unregistering in re-registering
> > this using regsvr32 e.g. regsvr32 C:\Program Files\Microsoft SQL
> > Server\90\DTS\Binn\DTS.dll
> >
> > Run this with the /u flag will unload the dll if necessary.
> >
> > If you are not using SP1 you may want to load this to see if the problem
> > is
> > resolved. If this does not cure the issue please post error numbers and
> > the
> > full error message and any information from the event log as well.
> >
> > HTH
> >
> > John
> >
> > "00KobeBrian" wrote:
> >
> >> I tried to import an excel file using import/export wizard. When I launch
> >> it, it gives me an error:
> >>
> >> The SSIS Runtime object could not be created. Verify that DTS.dll is
> >> avaible
> >> and registered. The wizard cannot continue and will terminate.
> >>
> >> Additional Information:
> >> Unable to cast COM object of type ...
> >>
> >>
> >> Can anyone please tell me how to fix this? Thanks.
> >>
> >>
> >>
>
>

import a dynamic file name into a known table

How would I import a dynamic file name into a known table?

I have the file name in a variable. So what object in SSIS do I use to do this.

Thanks

If you just want to insert file name into table, why do you need SSIS? You can just use an insert command which takes the file name variable as parameter.|||

I have inherited a SSIS package that does massive amounts of importing, so I am trying to stay with the way it eas done.

Out of curiosity how woul I do what you said? How would I do it in SSIS?

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.