Error Invalid Use Of Side-effecting Or Time-dependent Operator In 'EXECUTE STRING' Within A Function

May 8, 2008



Hi all, mister
I want create a function but I get this error: Error Invalid use of side-effecting or time-dependent operator in 'EXECUTE STRING' within a function

I think in a function, cannot use temp tables, or calling exec or store procedures.

Which is the best solution for my issue ? develop store procedure ??

thanks.

CREATE FUNCTION fnObtenerTablaMaestra ()

RETURNS @T Table ( Descripcion VARCHAR(20) NOT NULL, CIF VARCHAR(8) NULL )

AS

BEGIN

DECLARE @cmd nvarchar(max)

DECLARE @sql nvarchar(max)

DECLARE @nexoUNION NVARCHAR(max)

DECLARE @params nvarchar(max)

DECLARE @NombreTabla VARCHAR(MAX)

DECLARE @Descripcion VARCHAR(MAX)

DECLARE @CIF VARCHAR(MAX)

-- Cannot access temporary tables from within a function.

-- IF EXISTS (SELECT TABLE_NAME FROM tempdb.INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '#tmpTable%')

-- DROP TABLE #tmpTable

-- CREATE TABLE #tmpTable ( Descripcion VARCHAR(20) NOT NULL, CIF VARCHAR(8) NULL )



SET @nexoUNION = NULL



DECLARE c1 CURSOR for

SELECT [CD_NOMBRE_TABLA], [DS_CAMPO_DESCRIPCION], [DS_CAMPO_CIF] FROM [TABLA_MAESTRA]



OPEN c1

FETCH c1 INTO @NombreTabla, @Descripcion, @CIF

--FETCH NEXT FROM c1 INTO @NombreTabla, @Descripcion, @CIF

WHILE @@FETCH_STATUS >= 0

--WHILE @@FETCH_STATUS = 0

BEGIN

SELECT @sql =

'INSERT INTO #tmpTable

N'''+ @NombreTabla + '''

N'''+ @Descripcion + '''

N'''+ @CIF + ''''



SELECT @sql =

'SELECT ' + @Descripcion + ', '+ @CIF + ' FROM ' + @NombreTabla

IF @nexoUNION IS NULL

BEGIN

SET @nexoUNION = 'UNION'

END

ELSE

SET @sql = @nexoUNION + ' ' + @sql



-- EXECUTE (@sql)

--Exec(@sql)

FETCH c1 INTO @NombreTabla, @Descripcion, @CIF

--FETCH NEXT FROM c1 INTO @NombreTabla, @Descripcion, @CIF



END

CLOSE c1

DEALLOCATE c1

--SET @sql = 'SELECT Descripcion, CIF FROM #tmpTable'

-- Error Invalid use of side-effecting or time-dependent operator in 'EXECUTE STRING' within a function

EXECUTE(@sql)

RETURN

END

GO

View 1 Replies


ADVERTISEMENT

SQL/CLR DML Error: Invalid Use Of Side-effecting Or Time-dependent Operator

Apr 18, 2008

I am attempting to use a CLR Function to perform an update operation, since a SQL UDF will not allow this within the function. For the POC, I hard-coded the db connection string and setup the assembly to use EXTERNAL_ACCESS. This worked fine and the update operation was running properly via the CLR Function. However, I now want to make the code run in the current db context without plugging in a connection string. So, I've applied "context connection=true" instead of the explicit db string. When I do this, I am receiving the following error:


A .NET Framework error occurred during execution of user defined routine or aggregate
'MyTestCLRUDF':

System.Data.SqlClient.SqlException: Invalid use of side-effecting or time-dependent operator in 'UPDATE' within a function.

System.Data.SqlClient.SqlException:

etc.


I don't understand why simply swapping the connection string would cause this issue. I assume this is somehow related to permissions, and I am missing something. I've tried using each of the three permission levels (external, safe, and unsafe), and no luck.

Any help is appreciated! Here's the code:


public static bool MyTestCLRUDF(Guid myID)

{

string connectionString = "context connection=true";

using (SqlConnection connection = new SqlConnection(connectionString))

{

SqlCommand command = new SqlCommand("MySprocName", connection);

command.CommandType = CommandType.StoredProcedure;

SqlParameter parameter = new SqlParameter("@ID", myID);

command.Parameters.Add(parameter);

connection.Open();

command.ExecuteNonQuery();

connection.Close();

}

return true;

}

View 6 Replies View Related

Error: Invalid Operator For Data Type

Nov 9, 2007

this is an error i am getting trying to run the query below.
Invalid operator for data type. Operator equals minus, type equals varchar

SELECT regardingobjectidname, actualend, owneridname, createdbyname, activitytypecodename
FROM (SELECT regardingobjectidname, actualend, Owneridname, createdbyname, activitytypecodename, row_number() OVER (Partition BY
regardingobjectid
ORDER BY actualend DESC) AS recid
FROM FilteredActivityPointer
WHERE statecodename = 'completed') AS d
WHERE recid = 1 AND (owneridname IN (@user)) AND (activitytypecodename = 'phone call' OR
activitytypecodename = 'e-mail' OR
activitytypecodename = 'fax') AND (actualend > dateadd(d, -'
+ CONVERT(nVarChar(20), @NeglectedDays) + ',GetUTCDate()
ORDER BY actualend

Compnetsyslc

View 9 Replies View Related

The Left Side Of Like Operator

Mar 10, 2008

 
I have a select statement which accepts 2 variable in the "where" condition.
select username from user where variable1 like variable2. But the problem is in the left side of "like" statement if i use fieldname i get the result , but if i use variable name to represent a fieldname then i dont get the result.
 
Any ideas??

View 6 Replies View Related

Transact SQL :: Invalid Length Parameter Passed To LEFT Or SUB-STRING Function

Jul 22, 2015

when I am trying to perform below query,
 
  INSERT INTO EMPLOYEE
    SELECT TOP 100 *
 FROM EMPLOYEE_LANDING;

I am getting Invalid length parameter passed to the LEFT or SUBSTRING function.

View 3 Replies View Related

HTTP Error 403 - SQL Server 2005 And ASP.NET Version 1.1 Apps Side-by-side

Aug 31, 2006

I have a Windows 2003 Server running IIS 6.0 and SQL Server 2005. I have just (Today) deployed the first ASP.NET application (developed in Visual Studio 2003 and, as such, dependent on .NET Framework 1.1) on this server and am getting HTTP Error 403 (You are not authorized to view this page). This ASP.NET application runs fine on another server that is configured with the OS=Windows Server 2003, IIS=6.0 but without SQL Server 2005 and without the .NET Framework version 2.0. I found in the IIS Application configuration (on the troublesome site) that my app (in the Default Web Site folder) was pointing to the version 2.0 aspnet_isapi.dll. All efforts to use aspnet_regiis to "re-align" my app with version 1.1 have been fruitless to eliminate the HTTP Error 403. I granted the NETWORK SERVICE account privledges to the wwwroot folder. At this point, I don't know if I have a Framework error or a privileges problem.

Please help.

Thanks,

Rob

View 1 Replies View Related

Run-Time Error Invalid Use Of Null

Oct 4, 2012

I was using Access 2010, now i Upsized it to MS SQL 2012.

I'm getting Run-Time error '94'

---------------------------------------------------------------------

Public Function CalcOrderSubTotal(prmOrderID As Integer, _
Optional CallFromMacro As Boolean = True)
Dim varOrderSubTotal As Integer
Dim db As DAO.Database
Dim rs As Recordset
Dim strSQL As String

[Code] .....

View 2 Replies View Related

DTS Error- Invalid Class String

Aug 21, 2000

I'm running a DTS package from VB, it works great on my development machine. When I distribute the app to a clean client, I get a DTS error:

DTSStep_DTSDataPumpTask_1
Invalid Clss string
-2147221005
sqldts.hlp 700

I'm obviously connecting and executing the package correct, but I can't track down this error. The installation includes dtspkg.dll, dtspkg.rll, dtspump.dll, dtspump.rll, which are all registered. The username and password are hard code set in the package object before I execute it, so security should be the same.

Any suggestions on how to solve or track down this problem?

View 2 Replies View Related

Error : Invalid Class String

Aug 17, 2007

When trying to migrate a DTS package to SSIS Package ,
it gives error :

Erro : Invalid Class String

Please suggest .
Thanks in advance !!

View 3 Replies View Related

Invalid Operator For Data Type. Operator Equals Boolean AND, Type Equals Nvarchar

Jun 2, 2004

I get this error when I attempt to read from a datareader using the following sql statement:

Dim mysql As String = "SELECT PayrollTrans.PayrollID, Employees.[EmpFirstName] & ' ' & " _
& " Employees.[emplastname] AS FullName, Employees.[City] & ', ' & Employees.[State] & ' ' & Employees.[zip] AS CityState " _
& " , PayrollTrans.Date, PayrollTrans.EmployeeID, PayrollTrans.RegHours, " _
& " PayrollTrans.OTHours , PayrollTrans.RegPay, PayrollTrans.OTPay, " _
& " PayrollTrans.FedTax, PayrollTrans.FICATax, PayrollTrans.MedicareTax, " _
& " PayrollTrans.ESCTax, PayrollTrans.StateTax, PayrollTrans.ESCEMPTax, " _
& " PayrollTrans.FUTATax, PayrollTrans.NetPay, Employees.EmployeeID, " _
& " Employees.Address1, Employees.Address2, Employees.SSAN, " _
& " Employees.PayType, Employees.RegPayRate, Employees.OTPayRate, " _
& " Employees.MaritalStatus, Employees.FedExemption, Employees.StateExemption, " _
& " Employees.Active, Employees.SelectforPay, Employees.PayDate " _
& " FROM PayrollTrans, Employees where PayrollTrans.EmployeeID = Employees.EmployeeID;"

my reader command list as follows:

Dim objCM As New SqlClient.SqlCommand(mysql, SqlConnection1)
Dim objDR As SqlClient.SqlDataReader
objDR = objCM.ExecuteReader


Any ideas on where I am going wrong?

Thanks in advance

View 3 Replies View Related

Invalid Operator For Data Type. Operator Equals Boolean AND, Type Equals Datetime.

May 18, 2004

I am getting a error message saying: Invalid operator for data type. Operator equals boolean AND, type equals datetime.

I traced the pointer to @gdo and @gd, they are both dates!

INSERT INTO AdminAlerts values (CURRENT_USER, 'UPDATE', getDate(), @biui, 'Updated booking, ID of booking updated: ' & @biui & ', Booking date and time before/after update: ' & @gdo & '/' & @gd & ', Room number before/after update: ' & @rno & '/' & @rn & ' and Customer ID before/after update: ' & @cio & '/' & @ci)


If I cut that two dates out it works fine.
Could someone tell me the syntax to include a date in a string :confused:

View 3 Replies View Related

DTS = Error String: Invalid OLEVERB Structure

May 13, 2008

Hi all

Error string: Invalid OLEVERB structure

Error source: Microsoft Data Transformation Services (DTS) Package

Help file: sqldts80.hlp

Help context: 1100

Error Detail Records:

Error: -2147221504 (80040000); Provider Error: 0 (0)

Error string: Invalid OLEVERB structure

Error source: Microsoft Data Transformation Services (DTS) Package

Help file: sqldts80.hlp

Help context: 1100

Error: -2147221504 (80040000); Provider Error: 0 (0)

Error string: Invalid OLEVERB structure

Error source: Microsoft Data Transformation Services (DTS) Package

Help file: sqldts80.hlp

Help context: 5700

Error: -2147467259 (80004005); Provider Error: 0 (0)

Error string: [SQL-DMO]CreateFile error on '<xxxxxxxxx.yyyyyyyyy>'.

Error source: Microsoft SQL-DMO

Help file: SQLDMO80.hlp

Help context: 1131

DTSRun OnFinish: DTSStep_DTSTransferObjectsTask_1

DTSRun: Package execution complete.


Any body experianced same problem.

your help is Appreciated.

View 3 Replies View Related

Error: Invalid Length Parameter Passed To The SUBSTRING Function.

Sep 28, 2007

Hi,

I am using a simple procedure to pivot results (found in another forum and adapted it). It is done on SQL Server 2005 server with all service packs. Procedure:
**************
ALTER Procedure [dbo].[EthnicityPivot] @StDate as Datetime, @EndDate as Datetime
as
begin
DECLARE @Teams varchar(2000)

truncate table ForEthnicPivot

INSERT INTO ForEthnicPivot
SELECT DISTINCT COUNT(ID), Team, Ethnicity
FROM dbo._EthnicityByTeamEpisode
where Startdate between @StDate and @EndDate
GROUP BY Ethnicity, Team

SET @Teams = ''
--// Get a list of the pivot columns that are important to you.

SELECT @Teams = @Teams + '[' + Team + '],'
FROM (SELECT Distinct Team FROM ForEthnicPivot) Team
--// Remove the trailing comma

SET @Teams = LEFT(@Teams, LEN(@Teams)-1)
--// Now execute the Select with the PIVOT and dynamically add the list
--// of dates for the columns
EXEC( 'SELECT * FROM ForEthnicPivot PIVOT (SUM(countID) FOR Team IN (' + @Teams + ')) AS X' )
end
************

I can call the function:
exec EthnicityPivot '01/01/2007','09/09/2007'

and it works fine in SQL analyzer, but when I want to use it in Visual Studio in a new report I am getting this error
message:

There is an error in the query. Invalid length parameter passed to the SUBSTRING function. Incorrect syntax near ')'.

Anyone had similar error and sorted it?

Cheers

Polda

View 4 Replies View Related

FTP Using DTS. Error Invalid Format For String Source Names

Mar 31, 2004

Hi,
I am trying to do a simple ftp using DTS. I am using a Dynamic properties task as the file name is a bit complicated eg - f2368fd1.ext.040330.2
where 040330 is according to the date and the .2 is the second file for the day.
When i run the task, it fails giving me the error "Invalid format for string source names"

I then tried to use a simple file name such as TD.txt as a constant in the Dynamic properties task but still it fails. Any ideas ??

Thanks in Advance

View 2 Replies View Related

Ms Design Tools Invalid Class String - Error

Feb 27, 2008

ms design tools invalid class string - error


i use windows XP WITH SP-2 , SQL SERVER 2000 WITH SERVICE PACK 4, VISUAL STUDIO 6 WITH SP5, .NET 2.0,
VS2005.

I AM CURRENTLY GETTING THE ERROR WHEN I USE ENTERPRISE MANAGER IN SQL SERVER 2000.
WHEN I SELECT A PARTICULAR DATABASE AND A TABLE, AND WHEN I SELECT THE DATABASE DIAGRAM AND TRY TO CREATE A NEW DATABASE DIAGRAM, I GET THE ABOVE ERROR

View 5 Replies View Related

Error In Query; Invalid Length Parameter Passed To The Substring Function

Nov 28, 2005

Hi
i got errro mess "Invalid length parameter passed to the substring function" from this below. Anyone how can give me a hint what cause this, and how i can solve it? if i remove whats whitin thoose [] it works, i dont use [] in the code :)
colums:
VLF_InfectionDestination is nvarchar 254

SELECT TOP 10 tb_AVVirusLog.VLF_VirusName, COUNT(tb_AVVirusLog.VLF_VirusName) AS number
FROM tb_AVVirusLog INNER JOIN
__CustomerMachines002 ON tb_AVVirusLog.CLF_ComputerName = __CustomerMachines002.FalseName
WHERE (CONVERT(varchar, tb_AVVirusLog.CLF_LogGenerationTime, 120) BETWEEN @fyear + @fmonth + @fday AND @tyear + @tmonth + @tday) AND
(__CustomerMachines002.folder_id = @folderId) [OR
(CONVERT(varchar, tb_AVVirusLog.CLF_LogGenerationTime, 120) BETWEEN @fyear + @fmonth + @fday AND @tyear + @tmonth + @tday) AND
(tb_AVVirusLog.VLF_InfectionDestination LIKE N'%@%')]
GROUP BY tb_AVVirusLog.VLF_VirusName
HAVING (NOT (tb_AVVirusLog.VLF_VirusName LIKE N'cookie'))
ORDER BY COUNT(tb_AVVirusLog.VLF_VirusName) DESC

View 7 Replies View Related

[MS Visual Database Tools] - Invalid Class String. Error

Aug 1, 2005

We recently upgraded our SQL Server 2000 to SP4 and are now getting the following error whenever we try to open up Site Diagrams.

An unexpected error happened during this operation. [MS Visual Database Tools] - Invalid class string.

This is very frustrating since I can't easily edit my database relationships or see my ER diagram.

Any ideas how to fix this?

Thanks

View 3 Replies View Related

Invalid Operator For Data Type

Apr 28, 2006

What is wrong with this select statement?

SELECT lastName + ", " + firstName + " " + middleName as Name
FROM [users]
WHERE ([usrID] = 100)
I kept getting this error:

Msg 403, Level 16, State 1, Line 1
Invalid operator for data type. Operator equals add, type equals text.

Help is appreciated.

View 6 Replies View Related

Invalid Operator For Data Type.

Apr 28, 2006

What is wrong with this select statement:

SELECT lastName + ", " + firstname + " " + middleName + " " + maidenName as Name
FROM users
WHERE userID = 100;

I kept getting this error:

Msg 403, Level 16, State 1, Line 1
Invalid operator for data type. Operator equals add, type equals text.

Help is appreciated.

View 7 Replies View Related

Invalid Operator For Data Type.

Oct 23, 2005

Kudos to y'all experts out there. I kinda needed your help. I'm trying to run a query...


SELECT a.AUF_POS AS Pos, c.ZL_STR AS Panel, a.POS_TEXT AS Description, a.BREITE AS W1, a.HOEHE

AS H1, a.BREITE2 AS W2, a.HOEHE2 AS H2, SUM(b.ANZ) AS Qty, SUM(b.LIEFER_ANZ) AS Dlvd,

SUM(b.RG_ANZ) AS Inv, (a.BREITE*a.HOEHE/CAST(1000000 AS NUMERIC)) AS UnitSQM,

(a.BREITE*a.HOEHE*SUM(b.ANZ)/CAST(1000000 AS NUMERIC)) as TotPosSQM

FROM liorder..LIORDER.AUF_POS a INNER JOIN liorder..LIORDER.AUF_STAT b ON a.AUF_NR = b.AUF_NR

AND a.AUF_POS = b.AUF_POS INNER JOIN liorder..LIORDER.AUF_TEXT c ON a.AUF_NR = c.AUF_NR AND

b.AUF_POS = c.AUF_POS

WHERE (c.ZL_MOD = 0) AND (b.AUF_NR = '86260')

GROUP BY a.AUF_POS, a.POS_TEXT, a.BREITE, a.BREITE2, a.HOEHE, a.HOEHE2, a.SFORM_NR, c.ZL_STR


...and I keep getting this error: Invalid operator for data type. Operator equals multiply, type equals nvarchar. I've tried every possible CAST and CONVERT but I just can't make it work. I'm pretty sure that the data types for the columns I mentioned on the mathematical equation are all numeric. Please help...

View 1 Replies View Related

Odd Error Upon SqlDataReader.Read() Invalid Length Parameter Passed To The Substring Function.

Nov 12, 2003

An application I developed normally works great, but it seems that when processing a certian record (and none of the others so far), SQL Server throws this error:
"Invalid length parameter passed to the substring function."

Here's the code in question:

orderConnection.Open()
orderReader = orderCommand.ExecuteReader()
setControls(orderReader)

...

Private Sub setControls(ByVal dr As SqlDataReader)
If (dr.Read()) Then '<--*******problem line*******

The SqlDataReader (orderReader) doesn't blow up or anything until I call .Read() (and, as mentioned, this problem only occurs for one order). What could be happening here?

View 3 Replies View Related

Aspose License .Lic File Error Invalid Character In A Base-64 String

Jul 12, 2007



Hi,

I am using ASPOSE License(3rd party licensing tool).

Getting Error when using encrypted License file (*.lic) in my Application .

Error is .



"Invalid character in a Base-64 string "



What does it means ?????



But Demo License file *.lic is working fine.



Please provide solutions.



Reply is highly appreciated.



Rishi



Error is
Invalid character in a Base-64 string.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Invalid character in a Base-64 string.

Source Error:





Line 59:
Line 60: //license = new Licensing("Ghezt4vbwif7r9cf7ra2ttbKzv76+v7GAA==", licenceFile);
Line 61: license = new Licensing("Ghezt4vbwif7r9cf7ra2ttbKzv76+v==", licenceFile);
Line 62:
Line 63:
Source File: c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesTestLicenseApp_CodeDemo.cs Line: 61

Stack Trace:





[FormatException: Invalid character in a Base-64 string.]
System.Convert.FromBase64String(String s) +0
Aspose.License.Licensing.M0(String key, String encryptedString) +627
Aspose.License.Licensing.A0() +753
Aspose.License.Licensing..ctor(String key, String licenseFile) +72
Demo.Initialize() in c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesTestLicenseApp_CodeDemo.cs:61
Demo..ctor(String licenseFolder, Page page) in c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesTestLicenseApp_CodeDemo.cs:37
_Default.Page_Load(Object sender, EventArgs e) in c:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesTestLicenseDefault.aspx.cs:18
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3035


View 1 Replies View Related

SQL Server 2008 :: Varchar Invalid For Sum Operator

Oct 29, 2015

Below doesn't work for varchar column?

select sum(cast(Enter_your_field_name as int)) from Table_name

View 5 Replies View Related

Runtime Error: [Microsoft][ODBC SQL Server Driver]Invalid Time Format

Jul 23, 2005

Hello All,I am getting the following error when attemping to open a table inSQL2kSP3a.________________________________________SQL Server Enterprise ManagerDatabase Server: Microsoft SQL ServerVersion: 08.00.0760Runtime Error: [Microsoft][ODBC SQL Server Driver]Invalid time format_________________________________________I cannot find it in sysmessages, or on the web.Any ideas about how to resolve this? And how it occured...Thanks,TGru*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

Operand Data Type Nvarchar Is Invalid For Sum Operator

Jun 13, 2014

I am using the below query for calculation and I get this error.

Operand data type nvarchar is invalid for sum operator.

'$ '+ REVERSE(SUBSTRING(REVERSE(CONVERT(varchar,(CAST(round(isnull(sum(t7.[Pre Override Cost]),0),0) as money) + 1 -
cast(round(isnull(sum(t8.[Shared Dollars]),0),0)as money)),1)),4,255)) as [PreOverride L2],

'$ '+ REVERSE(SUBSTRING(REVERSE(CONVERT(varchar,(CAST(round(isnull(sum(t7.[Post Override Cost]),0),0) as money) -
cast(round(isnull(sum(t8.[Shared Dollars]),0),0)as money)),1)),4,255)) as [PostOverride L2]

View 6 Replies View Related

Call Vb.Net Developed Dll In SQL Server 2005 With Configuration Level 80 Then Gets Error Invalid Class String

Jul 14, 2006

Hi,
I want to call a dll from Stored procedure developed in SQL Server 2005 at configuration level 80. but when I execute the stored procedure I get the following error.

Error Source: ODSOLE Extended Procedure
Description: Invalid class string

Code of stored procedure and vb.net class is given below:

VB.Net
Imports System
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports Microsoft.VisualBasic
Imports System.Diagnostics

Public Class PositivePay

Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
' impersonate the calling user
Dim newContext As System.Security.Principal.WindowsImpersonationContext
newContext = SqlContext.WindowsIdentity.Impersonate()
Try
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
Catch Ex As Exception

Finally
newContext.Undo()
End Try
End Sub
End Class
===============================================================

STORED PROCEDURE
Create PROCEDURE [dbo].[PPGenerateFile]
AS

BEGIN
Declare @retVal INT
Declare @comHandler INT
declare @errorSource nvarchar(500)
declare @errorDescription nvarchar(500)
declare @retString nvarchar(100)

-- Intialize the COM component
EXEC @retVal = sp_OACreate 'PositivePay.class', @comHandler OUTPUT
IF(@retVal <> 0)
BEGIN
--Trap errors if any
EXEC sp_OAGetErrorInfo @comHandler,@errorSource OUTPUT, @errorDescription OUTPUT
SELECT [error source] = @errorsource, [Description] = @errordescription
Return
END

-- Call a method into the component
EXEC @retVal = sp_OAMethod @comHandler,'LogToTextFile',@retString OUTPUT, @LogName = 'D: ext.txt',@newMessage='Hello'
IF (@retVal <>0 )
BEGIN
EXEC sp_OAGetErrorInfo @comHandler,@errorSource OUTPUT, @errorDescription OUTPUT
SELECT [error source] = @errorsource, [Description] = @errordescription
Return
END
select @retString

END

View 6 Replies View Related

Reporting Services :: Operand Data Type Varchar Is Invalid For Divide Operator

Oct 23, 2015

I get this error "Operand data type varchar is invalid for divide operator".

select V.[Parent Name],
[ID],
round((V.SoftValue/VTMValue)*100,0) 'SPercentage',
round((V.HMUValue/VTMValue)*100,0) 'HPercentage2',
round((V.PrimaryValue/VTMValue)*100,0) 'PPercentage2'

[code]...

I have even converted the values to float.

View 5 Replies View Related

Date Function - Conversion Failed When Converting Date And / Or Time From Character String

Mar 18, 2014

I have the following

Column Name : [Converted Date]
Data Type : varchar(50)

When I try and do month around the [Converted Date] I get the following error message

“Msg 241, Level 16, State 1, Line 2
Conversion failed when converting date and/or time from character string.”

My Query is

SELECT
month([Created Date])
FROM [FDMS_PartnerReporting].[Staging].[Salesforce_MarketingReporting]

View 7 Replies View Related

Run Time Error While Execute Sql Server 2005 Integration Services Package From C#

Jun 6, 2006

Hi

I am trying to Execute an SSIS Package from C# Dot Net.

Below the code i am using.

try
{
Application app = new Application();
Package package = app.LoadPackage("DTSPackage/WinServeMonitoring.dtsx", null);
DTSExecResult result = package.Execute();
label1.Text = "Package Execution " + result.ToString();


}
catch (Exception exp)
{
label1.Text = exp.Message.ToString();
}

I have added reffrence for DTS Run time (using Microsoft.SqlServer.Dts.Runtime;)

But I am getting an Error like this

Error 1 'Application' is an ambiguous reference between 'System.Windows.Forms.Application' and 'Microsoft.SqlServer.Dts.Runtime.Application' C:Documents and Settingsvahqmd10My DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1Form1.cs 23 17 WindowsApplication1


Error 2 'Application' is an ambiguous reference between 'System.Windows.Forms.Application' and 'Microsoft.SqlServer.Dts.Runtime.Application' C:Documents and Settingsvahqmd10My DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1Form1.cs 23 39 WindowsApplication1


Error 3 The type 'System.Windows.Forms.Application' has no constructors defined C:Documents and Settingsvahqmd10My DocumentsVisual Studio 2005ProjectsWindowsApplication1WindowsApplication1Form1.cs 23 35 WindowsApplication1

Can any one Help me !

Regards

Deepu M.I

View 9 Replies View Related

Delete Error Of Dependent Row

Jan 9, 2007

I am not able to delete a row due to the presence of its parent table. There is no circular relationship and the child has no dependencies when I verify the Delete trigger. Any advice? See error msg below:

Msg 30010, Level 16, State 1, Procedure tD_My_child_table_name, Line 43

Cannot DELETE last My_child_table_name CI because My_parent_table_name exists.

Msg 3609, Level 16, State 1, Line 1

The transaction ended in the trigger. The batch has been aborted.

View 4 Replies View Related

Newbie To The Server Side - Connection String Question

Nov 25, 2006

Hi -

I am an SQL user from the development side, this is the first time I have been tasked to set up SQL Server. So far so good, although I'm having some issues finding the information I am normally familiar with to build a connection string to our database server.

1) We are on a dedicated server with a hosting company. They did not provide us with a licence for SQL Server 2005, so we had to install SQL Server 2005 Express. So far everything is going well, I have:

- gone through the proceedure to enable remote access to the database

- installed the Northwind test database

- installed msSQL Server Management Studio express, and I can see the db components.

I usually use Enterprise Manager to connect to and construct/manage my databases - however I am usually provided the connection string information.

- I have the database set to Windows Authentication Mode.

So my questions -

1. What is the connection string format to use (with .asp)? i usually use the following:

"Provider=SQLOLEDB;Data Source=DATABASEADDRESS;Database=DATABASENAME;User Id=USER;Password=PASSWORD;"

2. How do I find my server name? currently, in the database manager it shows as "WDC202SQLEXPRESS (SQL SERVER 9.0.2047 - WDC202USERNAME)" - where USERNAME is our current username. The system Databases and Northwind are listed below.

When i try to register using the above format connection string with Enterprise Manager, I get the connection not found or login. so my last question -

3. When i am setting up my connection string, should i be using the same user/pass set that logs me into the server - i am assuming this is the Windows Authentication credentials Ive set in the Server install.

Any help would be very much appreciated.

Thanks!
eric@thatsprettyhip.com








View 3 Replies View Related

Output 1 String With OR Operator

Sep 26, 2005

I have a table with a field that contains a filter string. I would like to combine the fields into 1 string with an 'OR 'logical operator.
eg.
FilterID 1 FilterString: (PROD.ProductID='10000')
FilterID 1 FilterString: (PROD.ProductID='10001')

Output as 1 line:
(PROD.ProductID='10000') OR (PROD.ProductID='10001')

SELECT FHDR.FilterID, FDET.QString
FROM tblFilters FHDR
INNER JOIN (SELECT QString = ????, FilterID
FROM tblFilterDetails
GROUP BY FilterID) FDET
ON FDET.FilterID = FHDR.FilterID

View 2 Replies View Related

Transact SQL :: Error - Conversion Failed When Converting Date And / Or Time From Character String

Nov 16, 2015

I've imported a CSV file into a table in SQL Server 2012. It's a large file, 140,000+ rows, so I couldn't covert it to Excel first to preserve the date format due to Excel's row limit. In the CSV file, there were 3 column with date data in "31-Aug-09" format, and the import automatically transformed these in "31AUG09" format (varchar(50)) in SQL Server.  Now I need to convert these 3 columns from varchar to datetime so I could work with them in date format.

I've tried several things,e.g,

select
convert(datetime,
right(admdate,4)+left(admdate,2)+substring(admdate,3,3))

or

select
convert(datetime,
substring(admdate,6,4)+substring(admdate,1,2)+substring(admdate,3,3))

but keep getting the same error message (Msg 241) "Conversion failed when converting date and/or time from character string".

View 4 Replies View Related







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