Sniffing StoredProc Input Parameters For General Error Handling

Dec 10, 2007

Hi,

id beg for a hint if our idea of a general dynamic CATCH handler for SPs is possible somehow. We search for a way to dynamically figure out which input parameters where set to which value to be used in a catch block within a SP, so that in an error case we could buld a logging statement that nicely creates a sql statement that executes the SP in the same way it was called in the error case. Problem is that we currently cant do that dynamically.

What we currently do is that after a SP is finished, a piece of C# code scans the SP and adds a general TRY/CATCH bloack around it. This script scans the currently defined input parameters of the SP and generates the logging statement accordingly. This works fine, but the problem is that if the SP is altered the general TRY/CATCH block has to be rebuildt as well, which could lead to inconstencies if not done carefully all the time. As well, if anyone modifies an input param somewhere in the SP we wouldnt get the original value, so to get it right we would have to scan the code and if a input param gets altered within the SP we would have to save it at the very beginning.

So the nicer solution would be if we could sniff the input param values dynamically on run time somehow, but i havent found a hint to do the trick.....

Any tipps would be appreciated...

cheers,
Stefan

View 1 Replies


ADVERTISEMENT

General Error Handling

Feb 14, 2006

Hello,

Originally we had laid out how we wanted our packages to work. In that concept we never really wanted our packages to fail but to offload the problem data to a file so that we could examine it (finding a problem in 1, 10, or 100 rows is easier than finding problems in 100,000 lines). The 2nd thing we want to achieve is to audit each task at the beginning and at the end. Very similar to how the the number of rows is shown in the dataflow.

Our first problem is that each task would require us to create a new file to offload the problem data. This quickly became a huge concern due to the number of files that we would have to maintain. The second problem is that we haven't figured out a way to capture the row count as it flows through the tasks and send that data to an audit table.

The auditing we want to do will go along way in ensuring that we can truly automate our packages which need to run once an hour.

Are any of you currently doing something of this nature and if so how did you go about handling some of the issues and concerns we have had?

Thank you in advance!

-Krusty

View 4 Replies View Related

Getting Row Order In Input File When Handling Errors

Aug 8, 2007

Hi All,

Well, tha case here is simply that i have a (Suppliers.csv) as an Input.
When taking that file, I do some validation on it's rows (Data type validations, Mandatory Fielda validations..etc).
When some rows to do not meet the requirments i put in these validations , it is supposed to be directed to an (Errors) Table in my SQL DB.

I want to include the order of the invalid row in the input File (The row which did not pass from the pre-mentioned validations) within the (Errors) Table when i direct the invalid rows to it.

Any ideas ?

View 1 Replies View Related

Handling Optional Parameters

Jul 27, 2007

On many reports I have optional parameters, for example if the employee is filled in it will run for that employee but if it's null it runs for all employees. Which is the best way to handle this?

The two options I am currently looking at are:

select * from employee where (employee.id = @EmpID or @EmpID is Null)

select * from employee where isnull(@empID, employee.id) = employee.id


Anyone else have a different solution?

Currently we use the OR approach and I wanted to see if anyone had any thoughts before switching to using IsNull, which seems a bit better.

View 8 Replies View Related

How To Specify Input Parameters?

Oct 16, 2006

I'm very new to SQL Server so please forgive me if this question is ridiculously simple. I have to upgrade the report engine from one that was used in a legacy VB6 app to a C#.net app. In doing so, I'm looking at assorted reports that came out of the old app. Here is the SQL code for one of them:

SELECT (LTRIM(STR(From_To,10,0)) + '-' + LTRIM(STR(From_To + 49,10,0))) AS Bonus_Earned, COUNT (Empl_ID) AS Men, round(SUM (SumDollars),2) AS Group_Earn, round((SUM (SumDollars) / COUNT (Empl_ID)),2) AS Calc0 FROM (SELECT CONVERT (int, round (SumDollars / 50, 2)) * 50 AS From_To, SumDollars, Empl_ID FROM (SELECT round(SUM (Actual_Hours_Dollars.Incentivedollars * Contract_History.Bonus_Pct / 100), 2) AS SumDollars, employees.Empl_ID FROM ((Employees INNER JOIN Actual_hours_dollars ON Employees.Empl_ID = Actual_Hours_Dollars.Empl_ID_R) INNER JOIN Contracts ON Actual_Hours_Dollars.Contract_ID = Contracts.Contract_No) INNER JOIN Contract_History ON Contracts.Contract_Idx = Contract_History.Contract_Idx_R where employees.empl_idx = (SELECT max(empl_idx) FROM Employees AS OuterEmployees WHERE OuterEmployees.empl_id = employees.empl_id AND outeremployees.Datex = (SELECT max(datex) FROM Employees AS InnerEmployees WHERE InnerEmployees.empl_id = employees.empl_id AND Inneremployees.disabled = 0 AND Inneremployees.Datex < '~EndDate~')) AND Contracts.Datex = (SELECT max(datex) FROM Contracts AS InnerContracts WHERE InnerContracts.contract_no = Contracts.contract_no AND InnerContracts.disabled = 0 and InnerContracts.deleted = 0 AND InnerContracts.Datex < '~EndDate~') AND Actual_hours_dollars.Datex >= '~StartDate~' AND Actual_Hours_Dollars.Datex < '~EndDate~' AND dateadd(month, Contract_History.Monthx - 1, dateadd(year, Contract_History.Yearx - 1900, '01 Jan 1900')) >= '~StartDate~' AND dateadd(month, Contract_History.Monthx - 1, dateadd(year, Contract_History.Yearx - 1900, '01 Jan 1900')) < '~EndDate~' and Actual_Hours_Dollars.IncentiveHours <> 0 GROUP BY employees.empl_ID) AS InnerRS1 GROUP BY ROUND (SumDollars * 2, -2) /2, SumDollars, Empl_ID) AS InnerRS2 GROUP BY From_To

I'm only including it for completeness. The key thing I'd like to draw your attention to are two variables that are clearly input parameters: ~StartDate~ and ~EndDate~.

My question is this: If I want to copy this code into SQL Query Analyzer and run it to see what kind of results I get back, what's the simplest way to define these two input parameters? I'm hoping you could just show me the syntax to define them above the SELECT statement.

Robert Werner
Vancouver, BC

View 4 Replies View Related

Retrieve Date Using Input Parameters W/o GUI

Feb 20, 2005

HI
I want to retrieve data in between two date formats using a query in SQL?
can i do it w/o using GUI tools?
For Exp i have sales data from date 11/11/2000 to 11/2004.
now as a user i want to give Input paramete value ranging between 06/06/2002 and 07/07/2002?
Is there any SQL query which i can use to retrieve the above date values?
Thanx in Advance
VS

View 9 Replies View Related

Parameters Input Field Size

Jul 2, 2007

Hi,



is it possible to change the appearence of input fields for parameters on the report server? My parameter is Multi-value with quite large amount of available values. On report server, user can (without scrolling) see only the first value. Parameter values are quite long, so user has to move alternally with both vertical and horizontal scrollbars to find the right value.



Thanks

Janca

View 1 Replies View Related

Enable Error Handling When Writing Custom Source Component /custom Error Handling Component.

Apr 21, 2006

1) We are writing a custome Source component for Oracle with OCI calls, Could some one please let me know how to Enable Error Handling for the Same,

2) Is it possible to write Custome Error Handeling Component for SSIS? if yes could you please help me on how to write it.

Thanks in advance.

View 1 Replies View Related

How To Set User Who Can't Modify Any StoredProc And Data In Tables But Can Read Data In Tables And Any StoredProc ?

Jul 13, 2007

Please give me advise ครับ
 

View 1 Replies View Related

Insert Syntax When Passing Input Parameters

Dec 27, 2000

I'm trying something like this:

CREATE PROCEDURE Add_Junk @Dist char, @CheckNo int =null OUTPUT AS
Set NoCount On
BEGIN TRANSACTION
INSERT INTO Junk (Dist)
VALUES (@Dist)
COMMIT TRANSACTION
select @CheckNo=@@IDENTITY

If what I pass is "416" I only get the "4" in my database and nothing else.
I don't get an error message.
What is wrong with my syntax?

PS I'm using Microsoft SQL 7.0

View 2 Replies View Related

T-SQL (SS2K8) :: First And Last Day Prior Month As Input Parameters

Apr 16, 2014

I have to create a report and I want all activity for the previous month.

I need to calculate the First and Last Day Prior Month to be used as Input Parameters.

Would something like this be the case or is there a better solution?

[code="sql"]
SELECT DATEADD(month, DATEDIFF(month, -1, getdate()) - 2, 0) as FirstDayPreviousMonthWithTimeStamp,
DATEADD(ss, -1, DATEADD(month, DATEDIFF(month, 0, getdate()), 0)) as LastDayPreviousMonthWithTimeStamp
[/code]

I was thinking get the first day of the previous and current month to exclude the Timestamp and use a less then first day of current month?

View 3 Replies View Related

Execute Select Depending On The Input Parameters

Nov 14, 2006

Hello, a question please. Could anyone say me if I can create a store procedure with 2 'select's statements into. Besides, I'd want to know if I can execute a "select" depending on input parameters.

Something like this:

create storeproc
Param1, param2

if param1 <> null

Select *
from table
where id = param1

else

Select *
from table
where id = param2

end if

Thanks in advance....







View 2 Replies View Related

SSIS Web Service Task Input Parameters

Nov 7, 2006

There is not a way to pass parameters to input of Web Service tasks. I heard this problem is fixed with SQL2K5 SP1 and even the online doc says that one can choose either "value" or "variable" when specifying input for web service tasks, but after I installed what-I-think-is SP1, there is still no way to do this.

If one can only specify values (hard-coded) as input to web service tasks, then this would be a very severe limitation. I hope I'm wrong, so could someone please give a pointer. Thanks

Kevin Le

View 7 Replies View Related

Parameter-sniffing Help

May 8, 2008

This seems to be a classic parameter-sniffing problem -- except that I can't seem to force the query to run with the correct plan. The proc below tries to just select using LIKE. When I use a literal string predicate, I get a nice, fast index seek. All of the other variants do an index scan -- of the wrong index.

What else can I do to force SQL Server to use the correct index?


DROP PROCEDURE test_like
GO

CREATE PROCEDURE test_like
@searchText nvarchar(64)
AS

-- Straight literal string search. Runs quickly with index seek on companies.searchbrand

SELECT companyId
FROM companies
WHERE searchbrand LIKE 'adv%'


-- Each of the queries below does an index scan on the primary key index on companies.companyId
-- instead of doing a seek on the correct index.

-- Search for proc parameter

SELECT companyId
FROM companies
WHERE searchbrand LIKE @searchText


-- Search for proc parameter, with hint
SELECT companyId
FROM companies
WHERE searchbrand LIKE @searchText
OPTION ( OPTIMIZE FOR (@searchText = 'adv%') )

-- Local variable
DECLARE @localText nvarchar(64)
SET @localText = @searchText

SELECT companyId
FROM companies
WHERE searchbrand LIKE @localText

GO

EXEC test_like 'adv%'

View 1 Replies View Related

SQL Server 2012 :: Stored Procedure With One Or More Input Parameters?

Dec 17, 2013

I've been tasked with creating a stored procedure which will be executed after a user has input one or more parameters into some search fields. So they could enter their 'order_reference' on its own or combine it with 'addressline1' and so on.

What would be the most proficient way of achieving this?

I had initially looked at using IF, TRY ie:

IF @SearchField= 'order_reference'
BEGIN TRY
select data
from mytables
END TRY

However I'm not sure this is the most efficient way to handle this.

View 2 Replies View Related

SqlCommand Return And Output Parameters Not Working, But Input Does?

Feb 18, 2006

The foolowing code I cannot seem to get working right. There is an open connection c0 and a SqlCommand k0 persisting in class.The data in r0 is correct and gets the input arguments at r0=k0->ExecuteReader(), but nothing I do seems to get the output values. What am I missing about this?

System::Boolean rs::sp(System::String ^ ssp){

System::String ^ k0s0; bool bOK;

System::Data::SqlClient::SqlParameter ^ parami0;

System::Data::SqlClient::SqlParameter ^ parami1;

System::Data::SqlClient::SqlParameter ^ parami2;

System::Data::SqlClient::SqlParameter ^ paramz0;

System::Data::SqlClient::SqlParameter ^ paramz1;

System::Int32 pz0=0;System::Int32 pz1=0;

k0s = ssp;

k0->CommandType=System::Data::CommandType::StoredProcedure;

k0->CommandText=k0s;

paramz0=k0->Parameters->Add("@RETURN_VALUE", System::Data::SqlDbType::Int);

//paramz0=k0->Parameters->AddWithValue("@RETURN_VALUE",pz0);

//paramz0=k0->Parameters->AddWithValue("@RETURN_VALUE",pz0);

paramz0->Direction=System::Data::ParameterDirection::ReturnValue;

paramz0->DbType=System::Data::DbType::Int32;

parami0=k0->Parameters->AddWithValue("@DESCXV","chicken");

parami0->Direction=System::Data::ParameterDirection::Input;

parami1=k0->Parameters->AddWithValue("@SRCXV","UU");

parami1->Direction=System::Data::ParameterDirection::Input;

//paramz1=k0->Parameters->AddWithValue("@RCOUNT",pz1);

paramz1=k0->Parameters->Add("@RCOUNT",System::Data::SqlDbType::Int);

paramz1->Direction=System::Data::ParameterDirection::InputOutput;

paramz0->DbType=System::Data::DbType::Int32;

//k0->Parameters->GetParameter("@RCOUNT");

r0=k0->ExecuteReader();

//pz0=System::Convert::ToInt32(paramz0->SqlValue);

bOK=k0->Parameters->Contains("@RCOUNT");

//k0->Parameters->GetParameter("@RCOUNT");

pz0=System::Convert::ToInt32(paramz0->Value);

pz1=System::Convert::ToInt32(paramz1->Value);

ndx = -1;

while(r0->Read()){

if (ndx == -1){

ndx=0;

pai0ndx=0;

pad0ndx=0;

r0nf=r0->FieldCount::get();

for (iG1_20=0;iG1_20<r0nf;iG1_20++){

this->psf0[iG1_20]=this->r0->GetName(iG1_20);

this->psv0[iG1_20]=this->r0->GetDataTypeName(iG1_20);

this->psz0[iG1_20]=System::Convert::ToString(this->r0->GetValue(iG1_20));

this->pas0[ndx,iG1_20]=System::Convert::ToString(this->r0->GetValue(iG1_20));

if (psv0[iG1_20]=="int") {pai0[ndx,pai0ndx]=System::Convert::ToInt32(r0->GetValue(iG1_20));pai0ndx++;}

if (psv0[iG1_20]=="float") {pad0[ndx,pad0ndx]=System::Convert::ToDouble(r0->GetValue(iG1_20));pad0ndx++;}

}



}

else {

pai0ndx=0;

pad0ndx=0;

for (iG1_20=0;iG1_20<r0nf;iG1_20++)

{ this->pas0[ndx,iG1_20]=System::Convert::ToString(this->r0->GetValue(iG1_20));

if (psv0[iG1_20]=="int") {pai0[ndx,pai0ndx]=System::Convert::ToInt32(r0->GetValue(iG1_20));pai0ndx++;}

if (psv0[iG1_20]=="float") {pad0[ndx,pad0ndx]=System::Convert::ToDouble(r0->GetValue(iG1_20));pad0ndx++;}

}

}

ndx++;

}

r0nr=ndx;

r0->Close();

k0->Parameters->Remove(paramz0);

k0->Parameters->Remove(parami1);

k0->Parameters->Remove(parami0);

k0->Parameters->Remove(paramz1);

return true;

}

View 5 Replies View Related

Stored Procedures Management - Keeping Input Parameters Updated

Dec 4, 2003

Hi everyone

I have just starting creating some stored procedures for our system and have a question related to management of these.

When using input parameters using the following syntax:

CREATE PROCEDURE sp_someInputProcedure
@Username as varchar(16)
@Password as varchar(12)
@Name as varchar(50)
@Address as varchar(60)
@Zip as int
@City as varchar(30)
...
etc.

This is all well and good, but what if I make a change in the datamodel - for instance changing a datatype or the length of a varchar - do I need to remember to manually update all stored procedures that uses these columns/variables?

Seems like a bit of a hazzle. Is there an easier way to do this?

Many thanks,

Stian Danielsen
Epizone

View 4 Replies View Related

1 SP With Dynamic Input Parameters And Multiple Rows As The Source Of The Query

Dec 4, 2005

How can I run a single SP by asking multiple sales question eitherby using the logical operator AND for all the questions; or usingthe logical operator OR for all the questions. So it's alwayseither AND or OR but never mixed together.We can use Northwind database for my question, it is very similarto the structure of the problem on the database I am working on.IF(SELECT OBJECT_ID('REPORT')) IS NOT NULLDROP TABLE REPORT_SELECTIONGOCREATE TABLE REPORT_SELECTION(AUTOID INT IDENTITY(1, 1) NOT NULL,REPSELNO INT NOT NULL, -- Idenitifies which report query this-- "sales question" is part ofSupplierID INT NOT NULL, -- from the Suppliers tableProductID INT NOT NULL, -- from the Products table, if you choose--a ProductID, SupplierID is selected also by inheritenceCategoryID INT NOT NULL, -- from the Categories tableSOLDDFROM DATETIME NULL, -- Sold from which dateSOLDTO DATETIME NULL, -- Sold to which dateMINSALES INT NOT NULL, -- The minimum amount of salesMAXSALES INT NOT NULL, -- The maximum amount of salesOPERATOR TINYINT NOT NULL -- 1 is logical operator AND, 2 is OR)GOINSERT INTO REPORT_SELECTIONSELECT 1, 1, 2, 1, '1/1/1996', '1/1/2000', 10, 10000, 1 UNION ALLSELECT 1, -1, -1, 1, '1/1/1996', '1/1/2000', 10, 1000, 1You can ask all kinds of sales questions like:1-I want all employees that sold products from supplierID 1(Exotic Liquids), specifically the ProductID 2 (Chang) from theCategoryID 1 (Beverages) between Jan 1 1996 to Jan 1 2000 and soldbetween $10 and $10000 - AND for my 2nd sales question2-I want all employees that sold CategoryID 1 (beverages) betweenJan 1 1996 to Jan 1 2000 and sold between $10 and $1000I want to get the common result of both questions and find outwhich employee(s) are in this list.Here are some of the points:1-I want my query to return the list of employees fitting theresult of my sales question(s).2-If I ask three questions with the logical operator AND, I wantthe list of employees that are common to all three questions.3-If I ask 2-3-4. questions with the logical operator OR, I wantthe list of employees that are in the list of the 1st "successful"sales question (the first question that returns any employee isgood enough)4-You can ask all kind of sales question you want even if theycontradict each other. The SP should still run and returnnothing if that is the case.5-Let's assume you can have the same product name from the samesupplier but under different categories. So entering a ProductIDshould not automatically enter the CategoryID also; whereasentering the ProductID should automatically enter its SupplierID.6-SOLDFROM, SOLDTO, MINSALES, MAXSALES, OPERATOR are mandatoryfields, you can't leave them NULL7-SupplierID, ProductID and CategoryID are the dynamic inputparameters, there can be 5 different combinations to choose from:a-SupplierID onlyb-SupplierID and a ProductID,c-SupplierID and a CategoryIDd-SupplierID, ProductID and a CategoryIDe-CategoryID onlyf-Any time you choose a ProductID, the SupplierID valuewill be filled automatically based on the ProductID'srelationshipg-Any of the three values here that is not chosen by theuser will take a default value of -1 (meaning return ALLfor this Column, in other words don't filter by this column)The major problem I have is I can't use dynamic SQL for choosingthe three dynamic columns as the 2nd row of records would have adifferent selection of dynamic columns (at least I don't know howif the solution is dynamic SQL). The only solution I can think oflooks pretty bad to me. I would use a cursor, run each row at atime, store a TRUE, FALSE value to stop processing or not andstore the result in another detail table. Then if all ANDquestions have ended with TRUE do a union of all the result andreturn the common list of employees. It sounds pretty awful as anapproach. I am hoping there's a simpler method for achieving this.Does anyone know if any SQL book has a topic on this type ofquery? If so I'll definitely buy the book.I appreciate any help you can provide.Thank you

View 7 Replies View Related

Dyanamically Passing Input Parameters To Stored Procedure By Using SSIS

May 14, 2008

Hi,

I have 2 source tables emp_ass,aprvl_status these tables are not having common column to join. and 1 target table Time_Card, i have a stored procedure with 4 input parameters, emp_ass_id,status_id,start date,end date,i am inserting data into timecard based on emp_ass_id, my week start date is sunday and end date is saterday if emp start date is sunday i am just incremnting the start date by 7 days as end date is saterday and inserting that row, if employe statrt date is other than Sunday. i am just insering start date with to reach end date saterday, this work fine when i give the input parameters, now my reqirement is i need to automate this process as i need to get new emp_ass_id which is not in target table and insert his records based on his start date and end date,
ex:
if emp_ass_id is 1001, start date 1/1/2008 and end date is 2/1/2008 then i need to insert

Uniq_Id, emp_ass_id, start_date end_date status_id





1099

1001

1/1/2008 12:00:00 AM
1/5/2008 12:00:00 AM 1








1100

1001

1/6/2008 12:00:00 AM
1/12/2008 12:00:00 AM 1








1101

1001

1/13/2008 12:00:00 AM
1/19/2008 12:00:00 AM 1








1102

1001

1/20/2008 12:00:00 AM
1/26/2008 12:00:00 AM 1








1103

1001

1/27/2008 12:00:00 AM
2/2/2008 12:00:00 AM 1






the stored procedure will insert these records if i give the input parameters, now i need to automate this process by using SSIS. please help me,i need to get emp_ass_id,start_date,end_date dynamically from source table if emp_ass_id is not in target table.

Thanks in advance.

View 9 Replies View Related

Parameter Sniffing Problem

Feb 26, 2007

Hi,
Is somebody will give me some idea about the parameter sniffing?
What is parameter sniffing??
How to overcome with this problem???
I have one procedure that is causing this problem.
Plz give me some tips to modify this proc to overcome this problem

dbo.cm_test (
@fromdate datetime = '01/01/1900',
@thrudate datetime = '12/31/9999'
)
As
Begin
SET ANSI_WARNINGS OFF
set nocount on
declare @minln smallint,
@CID char(24),
@EID numeric(12,0),
@extractdate datetime

/* Begin gathering data */
select @extractdate = getdate()
/* Begin gathering data */
if exists (select * from tempdb..sysobjects where name like '#tmpWTClm%')
drop table #tmpWTClm

create table #tmpWTClm (
ClaimID char(24) not null,
EventID numeric(12,0) not null)

insert into #tmpWTClm
select Rem.ClaimID, Rem.EID
from Rem, RemOut2
where Rem.CID= RemOut2.CIDand
Rem.EID= RemOut2.EIDand
(ReimProcessDate between @fromdate and @thrudate)

insert into #tmpWTClm
select distinct ClaimID, EID
from PaymentsDetail
where ProcessDate between @fromdate and @thrudate

insert into #tmpWTClm
select distinct ClaimID, EID
from ClaimDenials
where DenialProcessDate between @fromdate and @thrudate

insert into #tmpWTClm
select distinct ClaimID, EID
from ClaimAppeals
where AppealProcessDate between @fromdate and @thrudate

declare ClmDataCursor cursor for
select distinct ClaimID, EventID
from #tmpWTClm

open ClmDataCursor
fetch ClmDataCursor into @claimid, @EID

while (@@fetch_status = 0)
begin
insert into WTDenialAppealExtract
select distinct
from Rem, Rem1
where Rem.CID= Rem1.CIDand
Rem.EID= Rem1.EIDand
Rem.CID= @CIDand
Rem.EID= @eventid

fetch ClmDataCursor into @CID , @EID
end

close ClmDataCursor
Deallocate ClmDataCursor

Thanks

View 4 Replies View Related

Urgent : DB-Library Error 10007: General SQL Server Error: Check Messages From The SQL

Jul 20, 2005

DB-Library Error 10007: General SQL Server error: Check messages fromthe SQLServer.CREATE PROCEDURE [dbo].[spu_Import_Export_Image](@srvr varchar(50),@db varchar(50),@usr varchar(15),@pwd varchar(50),@tbl varchar(50),@col varchar(50),@mod varchar(1),@imgpath1 varchar(1000),@pk varchar(50))ASBEGINdeclare @path varchar(50)declare @whr varchar(200)declare @fil varchar(100)declare @cmd varchar(1000)declare @imgpath varchar(800)declare @ext varchar(5)--declare @pk varchar(50)declare @KeyValue varchar(8000)declare @image varchar(50)--declare @imgpath1 varchar(1000)declare @imgpath2 varchar(1000)declare @sellist varchar(2000)set @path = 'c: extCopy.exe'select @sellist = 'DECLARE curKey CURSOR FOR SELECT ' + @pk +' FROM '+ @tbl + ' ORDER BY ' + @pkexec (@sellist)OPEN curKeyFETCH NEXT FROM curKey INTO @KeyValueWHILE (@@fetch_status = 0)BEGINset @whr = '"where '+ @pk +' = "' + @KeyValueset @fil = @imgpath1 + '' + @KeyValue --+ @extset @cmd = @path + ' /S ' + @srvr + ' /D ' + @db + ' /U ' + @usr+ ' /P ' + @pwd+ ' /T ' + @tbl + ' /C ' + @col + ' /W ' + @whr + '/F ' + @fil+ ' /' + @modexec Master..xp_cmdShell @cmdFETCH NEXT FROM curKey INTO @KeyValueENDCLOSE curKeyDEALLOCATE curKeyENDGOAbove srcipt runs fine with image data type in one table but when irun for some other table it gives me Error MessageTEXTCOPY Version 1.0DB-Library version 8.00.194SQL Server 'WSQL01' Message 170: Line 1: Incorrect syntax near '99'.(Concerning line 1)DB-Library Error 10007: General SQL Server error: Check messages fromthe SQLServer.ERROR: Could not use database 'test1'NULL-----------Aslo it only runs on server console if i run it from workstation uingsame files and tables it gives me an error again. Can anybody help meand reply me at Join Bytes! asap.thnx,dharmesh

View 1 Replies View Related

SQL Server 2005 DTS Problem: Error 21776: General Error

Mar 5, 2007

I've recently migrated all databases to SQL Server 2005. I couldn'tfigure out how to create an SSIS package in the time I had, so I juststuck with the DTS packages. They all worked fine during testing, butonce we renamed the server we had problems. The DTS packages stillwork, but whenever I click into the Copy SQL Server Object and try toSelect Objects (on the Copy tab) I get this error:Microsoft SQL-DMOError 21776: General ErrorI click OK and get the error again and again for a total of 12 times(regardless of which database I'm connecting to in the packages, soit's not related to the number of objects in the database). Then theSelect Objects screen appears and it's business as usual.Has anyone else come across this problem and found a solution? I'verenamed the server using sp_dropserver and sp_addserver and select@@servername returns the correct valueJohn Hunter

View 1 Replies View Related

Execute SQL Task : Input And Output Parameters In Tsql Stataments With ADO.NET Connection Type

Jan 2, 2007

Hi Everyone,

I haven't been able to successfully use the ADO.NET connection type to use both input and output parameters in an execute sql task containing just tsql statements (no stored procedure calls). I have successfully used input parameters on their own but when i combine it with output parameters it fails on the simplest of tasks.

I would really find it beneficial if you could use the flexibility of an ADO.NET connection type as the parameter marker and parameter name can be referenced anywhere throughout the sql statement in no particular order. The addition of an output parameter would really make it great!!

Thanks



 

 

View 11 Replies View Related

How To Find Out Parameter Sniffing Problem In SQL Server???

Feb 27, 2007

Hi,
The database on which I am working, have 220 stored procedures.
I have to find out the procedures those have parameter sniffing problems. How I can find out???
Have any methode to find out this parameter snifffing problem.

View 1 Replies View Related

Accessing A Stored Procedure From ADO.NET 2.0-VB 2005 Express:How To Define/add 1 Output &&amp; 2 Input Parameters In Param. Coll.?

Feb 23, 2008

Hi all,

In a Database "AP" of my SQL Server Management Studio Express (SSMSE), I have a stored procedure "spInvTotal3":

CREATE PROC [dbo].[spInvTotal3]

@InvTotal money OUTPUT,

@DateVar smalldatetime = NULL,

@VendorVar varchar(40) = '%'



This stored procedure "spInvTotal3" worked nicely and I got the Results: My Invoice Total = $2,211.01 in
my SSMSE by using either of 2 sets of the following EXEC code:
(1)
USE AP
GO
--Code that passes the parameters by position
DECLARE @MyInvTotal money
EXEC spInvTotal3 @MyInvTotal OUTPUT, '2006-06-01', 'P%'
PRINT 'My Invoice Total = $' + CONVERT(varchar,@MyInvTotal,1)
GO
(2)
USE AP
GO
DECLARE @InvTotal as money
EXEC spInvTotal3
@InvTotal = @InvTotal OUTPUT,
@DateVar = '2006-06-01',
@VendorVar = '%'
SELECT @InvTotal
GO
////////////////////////////////////////////////////////////////////////////////////////////
Now, I want to print out the result of @InvTotal OUTPUT in the Windows Application of my ADO.NET 2.0-VB 2005 Express programming. I have created a project "spInvTotal.vb" in my VB 2005 Express with the following code:


Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Public Class Form1

Public Sub printMyInvTotal()

Dim connectionString As String = "Data Source=.SQLEXPRESS; Initial Catalog=AP; Integrated Security=SSPI;"

Dim conn As SqlConnection = New SqlConnection(connectionString)

Try

conn.Open()

Dim cmd As New SqlCommand

cmd.Connection = conn

cmd.CommandType = CommandType.StoredProcedure

cmd.CommandText = "[dbo].[spInvTotal3]"

Dim param As New SqlParameter("@InvTotal", SqlDbType.Money)

param.Direction = ParameterDirection.Output

cmd.Parameters.Add(param)

cmd.ExecuteNonQuery()

'Print out the InvTotal in TextBox1

TextBox1.Text = param.Value

Catch ex As Exception

MessageBox.Show(ex.Message)

Throw

Finally

conn.Close()

End Try

End Sub

End Class
/////////////////////////////////////////////////////////////////////
I executed the above code and I got no errors, no warnings and no output in the TextBox1 for the result of "InvTotal"!!??
I have 4 questions to ask for solving the problems in this project:
#1 Question: I do not know how to do the "DataBinding" for "Name" in the "Text.Box1".
How can I do it?
#2 Question: Did I set the CommandType property of the command object to
CommandType.StoredProcedure correctly?
#3 Question: How can I define the 1 output parameter (@InvTotal) and
2 input parameters (@DateVar and @VendorVar), add them to
the Parameters Collection of the command object, and set their values
before I execute the command?
#4 Question: If I miss anything in print out the result for this project, what do I miss?

Please help and advise.

Thanks in advance,
Scott Chang



View 7 Replies View Related

&#34;General SQL Error&#34;

Mar 1, 1999

I get the error "General SQL Error" when reading or writing to a memo field in Sql Server through a frontend build in Delphi 4.
I'm Using the latest BDE.
I have recently installed this onto a NT enviroment in the same manner as my own enviroment but get the error message above.

On my own enviroment and a friends enviroment I do not get any errors.

Can someone please give me some help on this or a direction to run in ?

Thanks

Dave.

View 1 Replies View Related

General Network Error

Apr 20, 2005

Hello.
I'm running into a rather intermittent problem when a search query is run on an ASP.Net web application.
The error is 'General Network Error' Check your Network Documentation...
As I said, it doesn't happen everytime which leads me to beleive that there is a problem with the database connection
There's probably no more than 50-60 max users hitting the app at any one time.
Anybody familiar with this?

View 1 Replies View Related

General Network Error On Asp .net 1.1

Feb 24, 2006

hi guys
i am developing my application on framework 1.1 on asp .net
i am trying to connect to sql server 2005 but it gives me error like general network error check your network documentation.
 
does any one know how to solve this error then pl reply fast
 
 

View 1 Replies View Related

General Network Error

Jul 28, 2005

Please help!Getting this error intermittently:System.Data.SqlClient.SqlException: Timeout expired. The timeout periodelapsed prior to completion of the operation or the server is notresponding. at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() After getting a fair number of these errors I get this one also:System.Data.SqlClient.SqlException: General network error. Check yournetwork documentation. at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehaviorcmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() SQL connection pooling is turned off. All sql parameters passed to thestored procedure and all the data types are correct.*** Sent via Developersdex http://www.developersdex.com ***

View 11 Replies View Related

General SQL Error - 2147221164

Jul 20, 2005

Hi all,I'm getting the above error in Delphi 4 when attempting to connect aTDatabase component to an MS Access table. I am following the belowinstructions:Database1.DatabaseName:='tryDB';Database1.DriverName:=MSACCESS;Database1.LoginPromt:=false;Database1.Params.Clear;Database1.Params.Add('DATABASE NAME=D:Projectspattern.mdb');Database1.Connected:=true;TDBGrid.DataSource:=DataSource1;DataSource1.DataSet:=Table1;Table1.DatabaseName:='tryDB';Table1.Active:=true;Any help would be appreciated.TIA,TJ

View 2 Replies View Related

General Network Error

Jul 20, 2005

I am running on Win2k, SQL Server 2000 (sp3), MDAC 2.8 and using aTCP/IP client connection.I get this error when attempting to restore a database.[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionRead(WrapperRead()).[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error.Check your network documentation.Does anybody know how to resolve this issue?Thanks

View 3 Replies View Related

General Network Error In DTS

Mar 11, 2008



Hi ,
can anyone explain what is general network error.
Im facing this error quite frequently during DTS uploading of data.
When ever DTS is running this error is generated and the specific package fails to load the data and continues
loading data for other packages and certainly interupts the loading process.
This error doesnt seems to occur on 1 package but on different.

Has anyone got a solution to solve this issue..

thanks and regards,
Mat

View 1 Replies View Related

Network General Error....

May 26, 2006

Hi Guys,

I have a problem with my application.when i try to run it to a network pc, show me this message "Network general error". But if i run it to simple pc everything ok.

Database is local. SQL Express agent running locally.Also all protocols for sql server is enebled.

Any ideas,,,,

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved