How To Call .NET Framework Library Within SPROC
Aug 1, 2007
Hi, with SQL server 2005.
Could I write a SPROC with C# or VB.NET that calls methods within the .net library or
Could I package a .net methods into a SPROC to let other SPROC invoke it?
Thanks in advance.
Ricky.
View 11 Replies
ADVERTISEMENT
Mar 18, 2004
I keep getting 0 returned, in both Query Analyzer and in my code. My double 'rate' just always ends up 0 or Null, and I've tried many different approaches. Here is the general idea. This is all for phone number searching.
I have a table with three columns - country, countrycode, and rate. The country code is two or three digits. In the code, I strip the first two digits of phoneNumber to make codeTwo and then strip the first three to make codeThree. That part works. I then pass codeTwo and codeThree to the sproc.
There are no overlapping codes (ie 23 and 237), so I search for a country code matching codeTwo and return that value. If none is found, then I search for a country code matching codeThree and return that value. If none is still found I return 0.
Here is the SQL 2000 stored procedure:
CREATE PROCEDURE getRate
(
@codeTwo int,
@codeThree int,
@rate int OUTPUT
)
AS
SELECT @rate = rate
FROM rates
WHERE countrycode = @codeTwo
IF @@rowcount = 0
SELECT @rate = rate
FROM rates
WHERE countrycode = @codeThree
RETURN@rate
GO
Here is the code calling the sproc:
string dbConn=ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection conn=new SqlConnection(dbConn);
SqlCommand cmd = new SqlCommand( "getRate", conn );
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter parmTwoCountry = cmd.Parameters.Add("@codeTwo", SqlDbType.Int);
parmTwoCountry.Value = codeTwo;
SqlParameter parmThreeCountry = cmd.Parameters.Add("@codeThree", SqlDbType.Int);
parmThreeCountry.Value = codeThree;
SqlParameter parmRate = cmd.Parameters.Add("@rate", SqlDbType.Int);
parmRate.Direction = ParameterDirection.Output;
try
{
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
rate = Convert.ToDouble(parmRate.Value);
}
catch(Exception ex){throw new Exception(ex.Message);}
finally {}
Thanks for your time,
dave
View 5 Replies
View Related
May 21, 2007
It is possible to call WCF from SQL CLR, can I add a web reference or use the proxy created with svcutil ?
View 1 Replies
View Related
Oct 5, 2007
Hi. This is a SQL question.
I am trying to wrap a stored procedure with a UDF so I can do selects against the result. The following doesn't work, but is it possible to do something like:
Create Function test()returns @tmp table ( myfield int)asbegin insert into @tmp (field1) Exec dbo.MySprocWhichRequires3ParmsAndReturnsATable 5, 6, 10 output returnend
Thanks
View 1 Replies
View Related
Jun 18, 2008
Hi. Apologies if this has come up before, I wonder if someone can help.
I want to call a sproc from a trigger, passing in the value of a field from the updated/inserted/deleted row.
It would be like spUpdateUser @UserID = x
where x is the value from one of the columns of updated row.
What is the syntax for this please? TIA
View 8 Replies
View Related
Mar 5, 2015
I'm trying to do something like this:
Loop through #Temp_1
-Execute Sproc_ABC passing in #Temp_1.Field_TUV as parameter
-Store result set of Sproc_ABC into #Temp_2
-Update #Temp_1 SET #Temp_1.Field_XYZ= #Temp_2.Field_XYZ
End Loop
It appears scary from a performance standpoint, but I'm not sure there's a way around it. I have little experience with loops and cursors in SQL. What would such code look like? And is there a preferable way (assuming I have to call Sproc_ABC using Field_TUV to get the new value for Field_XYZ?
View 2 Replies
View Related
Sep 22, 2007
Hi,
Can anybody help me with the following problem:
I have Vista Ultimate installed and within Vista .NET Framework 3.0 is installed as a part of the operating system so I can't remove 3.0
Now for MS SQL Server 2005 Express I need .NET Framework 2.0 and the SQL Server 2005 doesn't work with .NET Framework 3.0
Can't install 2.0, get the message that 3.0 is already installed.
Please help me!!
René
View 5 Replies
View Related
Feb 13, 2007
I have attached the results of checking an Update sproc in the Sql database, within VSS, for a misbehaving SqlDataSource control in an asp.net web application, that keeps telling me that I have too many aurguments in my sproc compared to what's defined for parameters in my SQLdatasource control.....
No rows affected.
(0 row(s) returned)
No rows affected.
(0 row(s) returned)
Running [dbo].[sp_UPD_MESample_ACT_Formdata]
( @ME_Rev_Nbr = 570858
, @A1 = No
, @A2 = No
, @A5 = NA
, @A6 = NA
, @A7 = NA
, @SectionA_Comments = none
, @B1 = No
, @B2 = Yes
, @B3 = NA
, @B4 = NA
, @B5 = Yes
, @B6 = No
, @B7 = Yes
, @SectionB_Comments = none
, @EI_1 = N/A
, @EI_2 = N/A
, @UI_1 = N/A
, @UI_2 = N/A
, @HH_1 = N/A
, @HH_2 = N/A
, @SHEL_1 = 363-030
, @SHEL_2 = N/A
, @SUA_1 = N/A, @SUA_2 = N/A
, @Cert_Period = 10/1/06 - 12/31/06
, @CR_Rev_Completed = Y ).
No rows affected.
(0 row(s) returned)
@RETURN_VALUE = 0
Finished running [dbo].[sp_UPD_MESample_ACT_Formdata].
The program 'SQL Debugger: T-SQL' has exited with code 0 (0x0).
And yet every time I try to update the record in the formview online... I get
Procedure or function sp_UPD_MESample_ACT_Formdata has too many arguments specified.
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.Data.SqlClient.SqlException: Procedure or function sp_UPD_MESample_ACT_Formdata has too many arguments specified.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I have gone through the page code with a fine tooth comb as well as the sproc itself. I have tried everything I can think of, including creating a new page and resetting the fields, in case something got broken that I can't see.
Does anyone have any tips or tricks or info that might help me?
Thanks,
SMA49
View 3 Replies
View Related
Apr 23, 2004
I'm sorta new with using stored procedures and I'm at a loss of how to achieve my desired result.
What I am trying to do is retrieve a value from a table before it is updated and then use this original value to update another table. If I execute the first called sproc in query analyzer it does return the value I'm looking for, but I'm not really sure how to capture the returned value. Also, is there a more direct way to do this?
Thanks,
Peggy
Sproc that is called from ASP.NET:
ALTER PROCEDURE BP_UpdateLedgerEntry
(
@EntryLogID int,
@ProjectID int,
@NewCategoryID int,
@Expended decimal(10,2)
)
AS
DECLARE@OldCategoryID int
EXEC @OldCategoryID = BP_GetLedgerCategory @EntryLogID
UPDATE
BP_EntryLog
SET
ProjectID = @ProjectID,
CategoryID = @NewCategoryID,
Expended = @Expended
WHERE
EntryLogID = @EntryLogID
EXEC BP_UpdateCategories @ProjectID, @NewCategoryID, @Expended, @OldCategoryID
Called Sprocs:
*********************************************
BP_GetLedgerCategory
*********************************************
ALTER PROCEDURE BP_GetLedgerCategory
(
@EntryLogID int
)
AS
SELECT CategoryID
FROM BP_EntryLog
WHERE EntryLogID = @EntryLogID
RETURN
*********************************************
BP_UpdateCategories
*********************************************
ALTER PROCEDURE BP_UpdateCategories
(
@ProjectID int,
@NewCategoryID int,
@Expended decimal(10,2),
@OldCategoryID int
)
AS
UPDATE
BP_Categories
SET CatExpended = CatExpended + @Expended
WHERE
ProjectID = @ProjectID
AND
CategoryID = @NewCategoryID
UPDATE
BP_Categories
SET CatExpended = CatExpended - @Expended
WHERE
ProjectID = @ProjectID
AND
CategoryID = @OldCategoryID
View 2 Replies
View Related
Jan 20, 2004
create procedure dbo.GetZipID( @City varchar(30), @State char(2), @Zip5 char(6))
as
DECLARE @CityID integer
declare @StateID integer
declare @ZipID integer
set @ZipID=2
set @Zip5=lTrim(@Zip5)
if @Zip5<>''
SET @ZIPID = (select Min(lngZipCodeID) AS ZipID from ZipCodes where strZipCode=@Zip5)
if @ZipID is null
set @CityID= EXEC GetCityID(@City);
set @StateID= EXEC GetStateID(@State);
insert into ZipCodes(strZipCode,lngStateID,lngCityID) values(@Zip5,@StateID,@CityID)
if @@ERROR = 0
SET @ZIPID = @@Identity
select @ZIPID
GetCityID and GetStateID are two stored procs, how do I execute those two stored procs
in the above stored proc? I mean what is the syntax??
Tks
View 2 Replies
View Related
Mar 19, 2008
Hi,
I am producing a php report using SQL queries to show the SLA status of our calls. Each call has response, fix & completion targets. If any of these targets are breached, the whole SLA status is set as 'Breach'.
The results table should look like the one below:
CallRef.
Description
Severity
ProblemRef
Logged
Date
Call
Status
SLA Status
C0001
Approval for PO€™s not received
2
DGE0014
05-01-06 14:48
Resolved
Breach
C0002
PO€™s not published
2
DGE0014
06-01-06 10:21
Resolved
OK
C0003
Approval for PO€™s not received from Siebel.
2
n/a
05-01-06 14:48
Investigating
OK
Whereas I can pick the results for the first 6 columns from my Select query, the 'SLA Status' column requires the following calculation:
if (due_date < completed_date)
{ sla_status = 'OK';
}
else sla_status = 'Breach';
The Select statement in my query is looking like this...
Select Distinct CallRef, Description, Severity, ProblemRef, Logdate, Status, Due_date, Completed_date;
The problem is that my query is returning multiple entries for each stage of the call (see below), whereas I just want one entry for each call, with SLA status 'Breach' if any of the stages for the call were out of SLA.
CallRef.
Description
Severity
ProblemRef
Logged
Date
Call
Status
SLA Status
C0001
Approval for PO€™s not received
2
DGE0014
05-01-06 14:48
Resolved
Breach
C0001
Approval for PO€™s not received
2
DGE0014
05-01-06 14:48
Resolved
OK
C0001
Approval for PO€™s not received
2
DGE0014
05-01-06 14:48
Resolved
Breach
Any help will be much much appreciated, this issue has been bothering me for some time now!!!
View 7 Replies
View Related
Jul 5, 2000
Hi!
When I use dbrpcparam to add empty string as a parameter to a stored
prosedure, as a result I have NULL, but I need to get an empty string.
It seems to me the DB library for C does not allow to pass an empty
string as a parameter of a stored procedure. It gets converted to NULL. ??
Do you know how I can avoid the problem?
Thank you.
Anny.
View 1 Replies
View Related
Sep 9, 1998
I am porting the proC programs from Oracle to C on windows. Does anybody know that If I am using DB library for C, does it support the dynamic binding of the table and conditions like Oracle`s embedded sql ( 4th method?)
ex: select unknown columns from unknown tables
where unknown colum= unknown value
Thanks.
View 3 Replies
View Related
Jul 20, 2005
We are looking for an ETL library or callable application that wouldallow us to transfer and transform data between platforms but mainlyinto a SQL server database. We would be calling this tool fromjavascript programs. Is there something out there in the midrangeprice-wise? So far I am finding just high-end ETL tools that are alittle over kill for us.Thanks.
View 4 Replies
View Related
Sep 29, 2006
This is not an actual question but more of a topic that I cannot find any information on and that may be because there is nothing about it.Basicly is there any SQL Database Table Libraries out there?......For instance I am creating a tedious database table right now which includes the names of all the countires (around 200 ) its simply used for a registration process where a users country information gets saved in the database...Since the worlds country names do not get changed very much is there a sql database table out there thats pre-made so I dont have to sit here and enter in all 200 or so countries by hand?....this is what I mean by database table libraries, it can basicly include all common things a website may use like a province/state dropdown list (pre-made database table), the worlds countries (again pre-made database table) and so on....If someone can come to my rescue and help me find some information on this it would be great cause well It's probably going to take a bit to enter in every country name, then the same for all the provinces/states, then bind them somewhat so when a user clicks on canada the provinces/states for canada are only avalible in the next list.Thank You All.Adam
View 2 Replies
View Related
Jul 6, 2000
I have been receiving the following error when I look into the NT error log
and I am not sure what it is referring to. First thing that happens is that I receive
an error that my Open Objects may be too low and then the following error:
DB-LIBRARY error - SQL Server connection timed out.
The source listed is SQLCTR60.
Can anyone help with this error???
View 2 Replies
View Related
Apr 3, 2007
Hi,
I have the following problem:
Anytime I`m starting the PC, the following message appears:
"SQLDUMPER library failed to initialize.....TRY TO RE-INSTALL THE FILE"
Could anyone help me deal with this? What should I do?
thank you, Enno
email: ebozdo@yahoo.com
View 7 Replies
View Related
Sep 19, 2007
Does anyone know if this SQL is part of MS Office or is it XP... I haven't figured that out. It says reinstall the program but doesn't say what program. I know I never intentionally installed an SQL program.
At this time I get the same message as everyone seems to be getting - SQL Dumper Library failed... reinstall ....
The problem for me started when I added Office 2007 and added the business contacts program.
Any ideas are appreciated!
View 1 Replies
View Related
Apr 12, 2008
when i start up my computer it displays the message sqldumper library failed initialization. your installation is either corrupt or has been tampered with. uninstall then rerun setup. what do i do?
View 5 Replies
View Related
Oct 10, 2007
HI all,i want to log different activities of my application like (order approved, order rejected etc) to a sql database using Enterprise Library 2.0.can anyone help me by giving a link(step by step procedure for this).or explain how to create my own sample application to log some event to DB(by creating a new database and tables for this).Thanks in advance.regards,Jon.
View 1 Replies
View Related
Feb 24, 2000
I have an application running on win 95/98 m/c which connects to SQl Server 6.5 Server on NT 4.0. From some of the client m/c i get an error message - 'DB-Library network Communications layer not loaded'. But from this client i am able to log on and use the enterprise manager. What could be the problem and how to resolve it ?
Thanks.
View 4 Replies
View Related
Feb 16, 1999
hi, I ran a query on a test database and got this error , does anyone tell me whatdoes it mean and how can I fix it
thanks
Ali
This command did not return data, and it did not return any rows
DB-Library Process Dead - Connection Brokenh
View 1 Replies
View Related
Nov 6, 1998
Hi All,
Would really like insights in determining how to fix the following problem.
( i did search the archives -- got nothing)
When I try to run query against the SQL server i get following message; Process 13 error "DB -library process dead", terminating connection.
Thanks a lot
Prasad
View 1 Replies
View Related
Aug 18, 2004
Hello,
I have encountered a problem doing an update on a Field defined as DECIMAL with dbcursor().
I have opened a cursor with dbcursoropen() with option LOCK_CC set. Then I have bound some char variables to CHAR Fields with STRINGBIND and some double Variables to the DECIMAL fields with FLT8BIND.
When I read the cursor, the data is correct in the bound variables. But when I do an update, all data for the numeric fields are gone and the database contains only NULL Values. The Strings are updated correctly.
I have tried to set the length, I am using the poutlen-variables with a value other than 0, but nothing helps.
Does anyone have an idea about what can I do?
Thank You in advance.
Frank
View 3 Replies
View Related
Apr 7, 2006
Hey guys,
I'm wondering if it's possible to see which library which a spid is using? For example, is the spid coming from a jdbc connection, or an odbc connection?
Thanks,
-Kilka
View 2 Replies
View Related
Aug 1, 2007
The In-row data RSVD page count for object "PermitSlots", index ID 0, partition ID 31139347693568, alloc unit ID 31139347693568 (type In-row data) is incorrect. Run DBCC UPDATEUSAGE
Hi, I received the following message after a DBCC run. This was fixed by a DBCC UpdateUsage. The question is, is there a reference where I can find details on errors as the above and their causes (other than Googling it or posting to a forum)?
Thanks
Drew
---------------------
"It's Saturday night; I've got no date, a two litre bottle of Shasta, and my all-Rush mix tape... LET'S ROCK."
View 6 Replies
View Related
Nov 1, 2005
Hi guys,Sounds a bit strange, however, if we could put some calculation instored procedure it would be quite convenient, just... where can I finda REGEXP library for matching checking? thanks.yours,athos
View 11 Replies
View Related
Aug 28, 2006
I'm trying to use SQL Server Everywhere with the Enterprise Library data access block. If I manually create a GenericDatabase using the SSev database provider it works fine, but I want to be able to use the DatabaseFactory.CreateDatabase method so it's all handled by the configuration in app.config.
When I do I get an exception. "Failed to find or load the registered .Net Framework Data Provider." within the ObjectBuilder code.
Does anyone have this combination working?
thanks,
View 4 Replies
View Related
Nov 21, 2007
Hello,
This is addressed to the SSIS team. I have found COM objects registration bug. The SQLTaskConnections.dll library has a couple of COM objects registered with invalid TypeLib element. If you search for GUID:
EF6D5D2C-8F86-4DBE-90F9-0B289E9577C3
You will find it in a couple of COM objects, but there is no such TypeLib registered. The correct TypeLib GUID should be:
E8E2265A-7E92-486C-AC8F-5ECC9B22F7CA
which I retrieved from the .tlb inside the library.
I'm getting the error: Could not load file or assembly 'Microsoft.SqlServer.SQLTaskConnectionsWrap, Version=9.3.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
and I think it can be related. I have read somewhere that Microsoft has recently changed the way .NET Runtime-Callawable-Wrappers are dealing with COM objects and it is quite possible this update has broken libraries like this.
Can you please someone forward this to the appropriate person responsible.
Thank you,
Ivan
View 6 Replies
View Related
Oct 18, 2007
Hi,
I´m wondering if is it possible to use the SSIS Class Library without SQLServer installed in the machine or if is it necessary to install SLQ Server in order to use SSIS objects?
thaks.
View 4 Replies
View Related
Feb 6, 2008
Hi gurus,
I have an application developed with VC++ 6.0 and communicating with SQL Server 2000 through DB-Library e.g. dblogin stuff.
With the release of SQL Server 2005, I don't find any DB-Library, every one is talking about Native Client to access SQL Server 2005. Native Client uses OLEDB or ODBC to access database.
Could someone help me, is there any DB-Library support available for SQL Server 2005.
View 1 Replies
View Related
Jan 11, 2007
Hi
Is there any way to get the Sql 2005 to load the .Net 3.0 Framework instead of 2.0, when running a Stored Proc?
Thanks
View 4 Replies
View Related
Sep 18, 2007
I have tried this at least 3 times now. I have done what other posts recommend. I have reinstalled the framework 2.0 from the SQL CD. I still get the prompt to install the framework when I click report builder. What's the solution ??
View 1 Replies
View Related