stored-procedures

How can i pass a null value for date in vb.net to sql stored procedure?

Hi guys, My application is asp.net with vb. In my page I have a textbox for passing date. If I didn't enter date and on clicking submit, I have to pass null value to the stored procedure. I tried following codes such as DBNull.Value and DateTime.MinValue. In that case instead of null ,"#12:00:00#" is passing. I have to pass Null. So can...

SQL 2000 Table Name as variable in stored procedure.

Table Name : RM_master Fields : cust_no acct_no acct_code Question is, I want to make the table RM_master as a variable in the parameters in the stored procedure? This has no syntax error but when I execute this in the query analyzer by right clicking on the stored procedure name the variable table name (RM_master) ...

[F#] Nullable values do not get modified when passed into C# code by reference.

I have an F# variable defined as follows let id = new Nullable<int>() and I am passing it from F# into a C# function that takes a ref Nullable<int> and, subsequently, assigns it a value (it's basically stored procedure code auto-generated by Linq2Sql). Unfortunately, when the function call exits, my id variable still has no value (i....

SQL Outer Join Function

I've written this function before but I can't seem to remember it and it didn't get into version control. Now, more to do with sleep deprivation than anything else, I can't remember how to rebuild it. Here's the idea. I have two tables, "regPrice" and "custPrice", with shared key "itemID." They both have a "price" column and custPrice a...

MySQL Query

Hi, I new to the MySQL syntax. I have created a procedure and ran it, but it is showing some syntax probem, can you help me? My procedure is as: **DELIMITER $$ CREATE PROCEDURE TestAdd( in mODE varchar(10), in Id int, in AttName varchar(10), in AttValues Varchar(10) ) IF EXISTS (SELECT * FROM AttTable WHERE id=Id) THE...

How to SELECT * INTO [temp table] FROM [Stored Procedure]

How do I do a SELECT * INTO [temp table] FROM [Stored Procedure]? Not FROM [Table] and without defining [temp table] ? Select all data from BusinessLine into tmpBusLine works fine. select * into tmpBusLine from BusinessLine Trying the same, but using a stored procedure that returns data, is not quite the same. select * into tmpBusLi...

Stored Procedure Select as Argument

Is the following possible: EXEC sp_Edu3_DeleteTreeStructure (SELECT TreeStructureId FROM TreeStructures) The SP normally takes one argument. What I want is that the SP is executed for each TreeStructureId found by the Query. thx, Lieven Cardoen ...

Problem injecting a VB parameter into a stored procedure (FireBird)

Everyone here has always been such great help, either directly or indirectly. And it is with grand hope that this, yet again, rings true. For clarification sakes, the Stored Procedure is running under FireBird and the VB is of the .NET variety I have a stored procedure (excerpt below, important bit is the WHERE) select pn, pnm.desc...

How to select values from two tables that are not contained in the map table?

Lets say I have the following tables: Customers Products CustomerProducts Is there a way I can do a select from the Customers and Products tables, where the values are NOT in the map table? Basically I need a matched list of Customers and Products they do NOT own. Another twist: I need to pair one customer per product. So If 5 cus...

SQL Stored Procedure: Conditional Return

Hi I want to create a simple stored proecudre which does the following: Psudocode @tempSelect = "SELECT * FROM Table" if (@Param is NULL) then exec @tempSelect else exec @tempSelect + ' WHERE id = ' + @Param + ' Is this method efficent? Thank you. ...

SQL Server - Individual Procedures vs. Single Procedure

Hi, In a system I'm developing I have a choice of either using a single stored procedure that does three related jobs and returns either no result, or the same result set, but sourced from two different tables. I read an article yesterday that suggested that a stored-procedure should only have one execution plan and that any procedure ...

What is the SQL Server CLR Integration Life Cycle?

How are CLR (.NET) objects managed in SQL Server? The entry point to any CLR code from SQL Server is a static method. Typically you'll only create objects that exist within the scope of that method. However, you could conceivably store references to objects in static members, letting them escape the method call scope. If SQL Server ret...

ssis : how to insert into oledb destination from oledb command

Hi I'm trying to insert in a ole db destination the result of a sp for each record in an ole db source, the sp returns a record set I have found this how to call a stored procedure in SSIS but i still can't see the outpout columns in OleDb Command Output Columns here is my sp: create PROCEDURE [dbo].[GetData] ( @user varc...

stored function getting output

Hey, Does anyone know how to get the output after the execution of the stored function??? thank you ...

Any contraindication of using Stored Procedures performing SELECT, UPDATE, INSTERT...

I'm using one SP performing all CRUD operations So, basically I'm executing same SP depending what action necesary: eg -- for select exec USP_ORDER @MODE='S', @ORDER_DATE='2009/01/01' -- for update exec USP_ORDER @MODE='U', @other_params -- for insert exec USP_ORDER @MODE='I', @other_params -- for delete exec USP_ORDER @MODE='D', @ID=1...

Could not find server 'dbo' in sys.servers

I have a lot of services which query the database. All of them work fine but one service calling a stored procedure gives me following error: Could not find server 'dbo' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.s...

Getting stored procedure usage data on SQL Server 2000

What is the best way to get stored procedure useage data on a specific database out of SQL Server 2000? The data I need is: Total of all stored procedure calls over X time Total of each specific stored procedure call over X time. Total time spent processing all stored procedures over X time. Total time spent processing specific stored...

Largest text usable variable in MSSQL 2005 Stored Procedure?

What is the largest size text usable variable in a MSSQL Stored Procedure. I'm seeing that largest size you can use is a varchar(8000). We can use ntext, text, etc. So does it require stitching varchars together? What about if I used a CLR Stored Procedure?? ...

How to find a text inside SQL Server procedures / triggers?

I have a linkedserver that will change. Some procedures call the linked server like this: "[10.10.100.50].dbo.SPROCEDURE_EXAMPLE". We have triggers also doing this kind of work. We need to find all places that uses "[10.10.100.50]" to change it. In SQL Server Management Studio Express I didn't find this feature, a "find in whole databas...

Object Relational Mappers in .NET and stored procedure usage

Given that they generate the Create, Read, Update, and Delete (CRUD) functionality for you in most cases, does this imply that stored procedures won’t be used as often? If these methods use LINQ then that means no stored procedures are used, correct? Any clarification is greatly appreciated. ...