stored-procedures

Syntax error converting datetime from character string.

Getting this error when updating a row via a gridview with a sqldatasource in Vb.net/SQL Server 2000. No matter what input (1/1/2010, blank, etc) I give it I can't seem to get it right. Code before the input is passed to the sp: Dim sqldatenull As DateTime Dim DateVerify As DateTime sqldatenull = DateTime.MaxValue ...

Binding empty list or null value to table valued parameter on a stored procedure (.net)

I have created a stored procedure that takes a table valued parameter that is a table with a single column of type int. The idea is to simply pass a list of ids into the store procedure and allow the sp to work with the data. However, in the case where there is no data to pass in, I am encountering problems (things work correctly when ...

SQL Server: procedure don't output anything?

I'm trying to create a stored procedure which will fetch data from sys.databases and sys.database_files and combine this information into a single result set. Here's the code CREATE PROCEDURE dbo.PROC_getDbInfo AS SET NOCOUNT ON GO TRUNCATE TABLE dbo.dbinfo GO EXECUTE sp_msforeachdb 'insert into dbo.dbinfo ...

How to Pass Variable into a MySQL Stored Procedure from PHP

I have the following stored procedure: proc_main:begin declare done tinyint unsigned default 0; declare dpth smallint unsigned default 0; create temporary table hier( AGTREFERRER int unsigned, AGTNO int unsigned, depth smallint unsigned default 0 )engine = memory; insert into hier values (p_agent_id, p_agent_id, dpth); /* http...

postgresql 8.4 trigger/storedproc error : how to fix it ?

Hi there, An INSERT on a table triggers a stored proc where the following error occurs. ERROR: column "targetedfamily" is of type boolean but expression is of type character varying Hint: You will need to rewrite or cast the expression. Where: PL/pgSQL function "fn_family_audit" line 19 at SQL statement And here's the ERRING stor...

execute command denied to user 'tisegoco_goitse'@'localhost' for routine 'tisegoco_tisego.offices

Hi I tried to upload my project on my machine and the error that I get from mysql is: execute command denied to user 'tisegoco_goitse'@'localhost' for routine 'tisegoco_tisego.offices I granted this user all privileges on the db. Now I am trying to access this procedure: delimiter // create procedure sample() begin select * ...

pass 2 parameters and use "like" in SQL Server 2005 Stored procedure

Hi, I want to pass 2 parameters to SQL stored procedure and use "like" statement as so: CREATE PROCEDURE dbo.StoredProcedure1 @project varchar(max) @group varchar(50) AS BEGIN SELECT * FROM table1 WHERE Projectname = @project and Resource_ID like '%' + @group + '%' END It says that there is incorrect syntax near @group a...

Is HibernateCallback best for executing SQL/procedures?

I'm working on a web based application that belongs to an automobil manufacturer, developed in Spring-Hibernate with MS SQL Server 2005 database. There are three kind of use cases: 1) Through this application, end users can request for creating a Car, Bus, Truck etc through web based interfaces. When a user logs in, a HTML form gets d...

SQL Server: using table or @table in stored procedure

I have a stored procedure (see below) which inserts data into a physical table and then joins information with sys.databases. I was thinking that would it be better to not have a physical table for data insertion? Would it be better to fetch these results into a table variable within this procedure? If so, how to do that? CREATE PROCEDU...

SQL Server: Error in Cursorless stored procedure

Hi I'm having trouble with this stored procedure, could you please help. This is error I'm getting - running all this via Oracle Sql developer on SQL Server 2000 hosted elsewhere. Error Error starting at line 1 in command: execute dbo.OF_ASEQ_EH_BROWNBIN 'dbo.EH_Brownbin_Josh','Match', 1 Error report: Incorrect syntax near the key...

Replacing part of an Oracle package

I need to modify one procedure from within a package. I need to touch both the declaration and the implementation. As I am maintaining patch files for each modification, I would like the changes to be minimal. Can I update the package with just the changed procedure ( if yes, how ? ) , or do I need to supply the complete package definit...

SQL Server: should I use information_schema tables over sys tables?

In SQL Server there is two schemas for metadata: INFORMATION_SCHEMA SYS I have heard that INFORMATION_SCHEMA tables are based on ANSI standard. When developing e.g. stored procedures, should it be wise to use INFORMATION_SCHEMA tables over sys tables? ...

SQL Server: how to use the same procedure in different instances?

I have a stored procedure in a test instance of a sql server (named sql2008test\sql2008_test) and it is located in one database. I would like to use this procedure also in production instance (named sql2008prod\sql2008_prod). Should I copy this procedure into this prod instance or can I modify my procedure somehow to query data from prod...

How to read in a text file from a stored procedure

I need to read in a log file created by a SSIS package in my stored procedure. Is there a good way to do this? I tried using this code but it shows the contents of my file as jibberish. Is there some kind of encoding issue it's not handling? Is there an easier way? ...

SQL Server 2005 Determine Stored Procedure Output Type

I'm working on a legacy system, and I need to call a stored procedure to retrieve the data I need. The problem is, I don't have any idea as to what the output column format is. Short of going into the stored procedure and figuring out the output column format from the SQL, is there a way for me to see what the output column types are? ...

SQL Stored Procedures failing to return values

I am working on a Tag system for a news page designed in ASP.NET. For the system I require a TagExists method to check for tags within the database. The stored procedure I have written is below. ALTER PROCEDURE [dbo].[Tags_TagExists]( @Tag varchar(50)) AS BEGIN If (EXISTS(SELECT * FROM dbo.Tags WHERE LOWER(@Tag) = LOWER(Tag))) ...

SQL Server - How to lock a table until a stored procedure finishes

I want to do this: create procedure A as lock table a -- do some stuff unrelated to a to prepare to update a -- update a unlock table a return table b Is something like that possible? Ultimately I want my SQL server reporting services report to call procedure A, and then only show table a after the procedure has finished....

MySQL Stored Procedure dynamic change name of table.

Hello, I wanna change dynamicaly name of table in sql query. For example I have next stored procedure: CREATE PROCEDURE NewProc(IN tableName varchar(64),IN message text) BEGIN INSERT INTO tableName VALUES (message); END; I need to change tableName in runtime, Can I to do it or not? Thanks. ...

SQL Server 2005 or Visual Studio 2005 - writing my first procedure, any tips or good starting points?

I'm about to write my first procedure to check if yesterdays data exists in one database, and if it select some of the data, use a count and insert that data into another database. If the data doesn't exist, then send me an email. I'm using SQL Server 2005 and I'd like to ask the community for tips or good starting knowledge on smart pr...

Call Oracle stored procedure from ASP VBscript

I have found the following ASP VB code from Microsoft Support, and as it is stated it should print in my browser the parameters that are required from my called stored procedure. I get the following error when I run it in my browser: Microsoft OLE DB Provider for Oracle (0x80040E14) ORA-06550: line 1, column 7: PLS-00306: wrong number o...