stored-procedures

Calling sproc from LINQ with an xml parameter

There is an existing sproc that for the purposes of this experiment I do not want to change. It is currently called via a non-linq method like a sqlcommand and takes an xml parameter. Current implementation (Non-Linq) An xml fragment eg: "<someTag>1</someTag><someTag>2</someTag>" is passed to the sproc as a string. Notice that ...

Passing whole dataset to stored procedure in MSSQL 2005

How do I pass a dataset object to a stored procedure? The dataset comprises multiple tables and I'll need to be able to access them from within the SQL. ...

How to Model/Document Existing Stored Procedure Flow

Hi, I started working with a GPS Tracking System, whose backend logic is almost entirely based on the execution of Stored Procedures. They were implemented on a SQL 2000 database. I received the task to document/model the existing stored procedure flow, but I don't have experience with such a task. I was used to UML, but since its focu...

SQL Server lat;lng varchar split procedure to use as Lat and Lng for speed Searching

Can someone help me using a stored procedure or function to passing my stored varchar lat;lng in table to individuals fields as float as Lat and Lng to use in radius search. lanlng in Table 33.0000;15.222222 Thanks ...

Stored procedure Auth

Hi, I'd like to authenticate users with the help of stored procedures. Here's what i've got so far... DELIMITER | CREATE PROCEDURE authenticateUser ( IN uname VARCHAR(64), IN passphrase VARCHAR(32) ) BEGIN SELECT u.id FROM users AS u WHERE u.email = uname AND u.pass = passphrase AND u.active = 1; END Now I'd like to add another fea...

MongoDB Stored Procedure Equivalent

Hello, I have a large CSV file containing a list of stores, in which one of the field is ZipCode. I have a separate MongoDB database called ZipCodes, which stores the latitude and longitude for any given zip code. In SQL Server, I would execute a stored procedure called InsertStore which would do a look up on the ZipCodes table to get ...

Stored Procedure return multiple result sets

I need a SP to return multiple sets of results. The second set of results would be based on a column of the first set of results. So: declare @myTable1 table(field0 int,field1 varchar(255)) insert into @myTable1 select top 1 field0, field1 from table1 declare @myTable2 table(field0 int,field3 varchar(255)) insert into @myTable2 selec...

Should I use a T-SQL function, view, or stored proc ?

Hi Guys, I've got a question about reusing table data but a view won't work in this scenario as I have a parameter that needs to be passed in. Basically this part of the system requires a travellerid to be sent to the procedure and a list of arrangers returned for that specific traveller. There are around 7 business rules that are used ...

Quick-n-dirty results: View results of Procedure OUT cursor in SQL Worksheet?

Platform: Oracle Language: PL/SQL Issue: Want to output a procedure OUT cursor into the SQLDeveloper SQLWosksheet. Anyone know how to use the Oracle "Select * from Table( PipelinedFunction( Param ) ) " to check procedure code output cursors? I am using Crsytal Reports off of an Oracle stored procedure. Crystal requires that a procedu...

SQL Stored Procedure Convert Date Parameter.

Hi, I have an sql stored procedure which accepts two dates, however when I send them in my open query, oracle does not like the date format for some reason.... How can I change the dateformat to YYYY-MM-DD from dd-mm-yyyy in the stored procedure before sending using it. e.g SET @startdate = CONVERT?? Thanks, Tina ...

Replace String in Oracle Procedure

I have a problem about oracle procedure,since I'm new in sql language :D, here is my query CREATE OR REPLACE PROCEDURE MONDESINT.UPDATECOADESCRIPTION IS DESCRIPT MONDES_MSTR_CHART_OF_ACCOUNT.NAMA_AKUN%type; BEGIN FOR SATU IN (select NO_AKUN, NAMA_AKUN from mondes_mstr_chart_of_account where NO_A...

Viemodel with stored Procedure

I am following the tutorial of scott gu from Here to retrieve the data using stored procedure. i am setting the return type of the stored procedure by dropping the SProc on class. Now my question is that can we set some viewmodel as the return type of the stored procedure, as my view is strongly typed with my viewmodel ...

"Debug"(get information) on a running stored procedure in MS Sql Server

Hello, i aked myself if it is possible in MS SQL-Server 2005 to get information of a running stored procedure. Because meanwhile it is executing for more than 8 hours, i would like to know on what step it is or if it is even actually running at all. MS SSMS says that it is still executing the query. Thanks in advance, Tim ...

Error in formating of XML string with CDATA

I get this error "Start tag on line 1 does not match the end tag of 'document'". string rawXml = "<?xml version='1.0' ?>" + "<document>" + "<![CDATA[" + "<topic>" + "My test" + "</topic>" + "]]>" + "</document>"; Error occurres when I try to...

Transferring Data between two SQL Server 2000 Repository.

I need to Extract data from a SQL repository Process It and then save it in 2nd Repository. Nature of data: Transfer selected users data, though the tables are similar in both repository but not same, and some amount of processing needs to be done on the data to be transferred. The volume data is very large 5,00,000. What technique ...

Conditional SQL ORDER BY ASC/DESC for alpha columns

Writing a stored procedure in MS SQL Server 2008 R2, I want to avoid using DSQL... I would like the sort method (ASC or DESC) to be conditional. Now, with a numeric column I would simply use a case statement and negate the value to emulate ASC or DESC... That is: ... ORDER BY CASE @OrderAscOrDesc WHEN 0 THEN [NumericColumn] ELSE -[Num...

How to call a procedure or fire a trigger when a new connection is established in SQL Server 2008

Hi i want to call a stored procedure or fire a trigger when a new connection is established in SQL Server 2008. Thanks ...

Getting a error defining MySql 5.1 stored procedure

I am defining a stored procedure and it throws an error at DECLARE variable. CREATE PROCEDURE test_proc() BEGIN DECLARE venueid VARCHAR(50); DECLARE i INT; Heres the Error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE venuei...

Can I: loop through sql select and then fire off for each loop?

Hi All, I'm probably missing something (looking at it too long), but in a stored procedure can I select all distinct values from one table and then do a for each loop based on each of those returned rows, which themselves build up sql statements based on the distinct values? Cheers. ...

Calling LDAP from a Stored Procedure

Background I'm trying to migrate from an LDAP identity store to a database backed implementation. There will be a migration period in which it will be necessary to sync any changes to passwords on the database with the LDAP store. My question is if its possible to make a LDAP modify call from a stored procedure on the Oracle Database. ...