stored-procedures

How to get the Time value from datetime picker

how to get the time value in a stored procedure form datepicker value i.e i have a datetime picker value stored into my table as '2010-04-06 09:00:00.000' '2010-04-07 14:30:00.000' i have got the date sepeartely using convert(varchar,Date,3) as Date.. i have got the time seperately using convert(time,Time) but it show the values as...

hibernate proxy ..

load() just returns a proxy by default and database won’t be hit until the proxy is first invoked. what does it mean by proxy exactly here ? ...

SQL Server Cursor data as result of stored procedure

Hello, I have a stored procedure DECLARE cursor FOR SELECT [FooData] From [FooTable]; OPEN cursor ; FETCH NEXT FROM cursor INTO @CurrFooData; WHILE @@FETCH_STATUS = 0 BEGIN SELECT @CurrFooData AS FooData; INSERT INTO Bar (BarData) VALUES(@CurrFooData); FETCH NEXT FROM cursor INTO @CurrFooData; END; CLOSE cursor DEALLOCATE curs...

SQLParameter not working properly

I am trying to access a stored procedure and I'm getting an error that says: Procedure or function 'getbug' expects parameter '@bugID', which was not supplied. This is my code to call the procedure. SqlCommand cmd = new SqlCommand("getbug", cn); cmd.Parameters.Add(new SqlParameter("bugID", bugID)); bugID is set as 1089 (and is t...

MSDN about stored procedure default return value

Hello, Could anyone point exactly where MSDN says thet every user stored procedure returns 0 by default if no error happens? In other words, could I be sure that example code given below when being a stored procedure IF someStatement BEGIN RETURN 1 END should always return zero if someStatement is false and no error occurs? I know...

Populate an SSRS Report parameter(hidden) by a sproc or user defined function

My SSRS report fetches data from my DATAWAREHOUSE. The ASP.NET application I have is connected to an OLTP database. I invoke the SSRS Report from my ASP.NET application and provide a parameter as CustomerID(this is an application key in datawarehouse) to my report. Since my report is connected to my datawarehouse, I do not query my re...

Sql server Stored Procedure

I m passing a variable to stored procedure, i want the proc to make a look up to another table and get the primary key of the table and insert that value to the table. Table A: pk_id int, user varchar Table B: userKey int locationKey int Someotherthings varchar Table C: pk_id int, Location varchar When i invoke sp_howto, and pa...

Establishing Upper / Lower Bound in T-SQL Procedure

Hi. I am trying to establish upper / lower bound in my stored procedure below and am having some problems at the end (I am getting no results where, without the temp table inner join i get the expected results). I need some help where I am trying to join the columns in my temp table #PageIndexForUsers to the rest of my join statement...

SQL - Stored Procedure with Select Statement using IN (@Variable_CommaDelimitedListOfIDS)

Hi I am creating a stored procedure to which I want to pass as variable a comma delimited list of Ids. I want to use the Ids into a select statement, something like: Create Procedure up_TEST @Ids VARCHAR(MAX) AS SELECT * FROM ATable a WHERE a.Id IN(@Ids) Obviously I get the error that @Ids is a varchar and not an INT but how can I...

Can I Assign a variable in a SQL Stored Procedure?

I am doing a SQL Insert to populate my table. I have a unique generated ID in one table that I would like to use in another table for my join. Is this possible? .NET MVC -- using (SqlConnection connect = new SqlConnection(connections)) { SqlCommand command = new SqlCommand("ContactInfo_Add", connect); command.Parameters.Add(n...

consistency of Trigger Procedure (before row trigger) Postgresql

Using Postgresql. I try to use TRIGGER procedure to make some consistency check on INSERT. The question is ...... whether "BEFORE INSERT FOR EACH ROW" can make sure each row to insert "checked" and "inserted" one after another? do I need extra lock on table to survive from concurrent insert? check for new row1 -> insert row1 -> check...

Inline Conditional Statement in Stored Procedure

Here is the pseudo-code for my inline query in my code: select columnOne from myTable where columnOne = '#variableOne#' if len(variableTwo) gt 0 and columnTwo = '#variableTwo#' end I would like to move this into a stored procedure but am having trouble building the query correctly. I assume it would be something like select...

Debugging in VS 2008 locks a stored procedure

Hi everyone, I've got a strange one here. I have a .Net executable that, under the hood, calls a few stored procedures. For whatever reason, one of the stored procs hangs when I'm debugging. If I run the executable outside of visual studio things go fine, including this stored proc. It's when I'm debugging that this hangs, and it re...

sp_addlinkedserver procedure not linking Excel source

I am attempting to link an Excel source to a SQL Server DB on the Go Daddy website.  When I execute the sp in SQL Server, it shows it executed successfully, but no data is linked. This is the main part of my procedure:      EXEC sp_addlinkedserver @server = 'XLHybrid', @provider = 'Microsoft.ACE.OLEDB.12.0',    @srvproduct ...

How do I return the IDENTITY for an inserted record from a stored Proecedure?

I am adding data to my database, but would like to retrieve the UnitID that is Auto generated. using (SqlConnection connect = new SqlConnection(connections)) { SqlCommand command = new SqlCommand("ContactInfo_Add", connect); command.Parameters.Add(new SqlParameter("name", name)); command.Parameters.Add(new SqlParameter("address", a...

ASP.NET Create User Wizard - Customisation help

Hi folks, I have used the asp membership feature to add user management to my web app. I have modified the default tables to include a couple more fields. On the create user wizard I have turned wizard step one into a customizable template and have added in the controls for the 2 fields. Do I know just modify the stored procedure used...

MySQL save results of EXECUTE in a variable?

How do I save the results of EXECUTE statement to a variable? Something like SET a = (EXECUTE stmtl); ...

Concurrency checking in Entity Framework with stored procedures while deleting

Hi, My UPDATE and DELETE logic are in stored procedures. I've built an entity framework model with mappings to these procedures. In spUpdate I return the new timestamp column so the EF could detect concurrency conflicts. It works fine. I have a problem with the spDelete because I don't see mappings for return values in the "delete fun...

Calling stored procedure from another stored procedure and returning result as new columns

How to call stored procedure from another stored procedure and return the result as first one's column? ALTER PROCEDURE [dbo].[GetItems] AS SET NOCOUNT ON SELECT ID, AddedDate, Title,Description, Result of Stored Procedure "CountAll" call with parameter ID as Total FROM dbo.Table1 And also: how to be if CountAll stored proced...

Generating the SQL query plan takes 5 minutes, the query itself runs in milliseconds. What's up?

I have a fairly complex (or ugly depending on how you look at it) stored procedure running on SQL Server 2008. It bases a lot of the logic on a view that has a pk table and a fk table. The fk table is left joined to the pk table slightly more than 30 times (the fk table has a poor design - it uses name value pairs that I need to flatte...