Error Executing Xp_cmdshell
Oct 1, 2007
I'm trying execute DTSX-package
Code Block
exec master..xp_cmdshell '"C:Program Files (x86)Microsoft SQL Server90DTSBinndtexec.exe" /FILE ...'
But have got error
Code Block
'C:Program' is not recognized as an internal or external command,
for some reason it doesn't work!
Or xp_cmdshell doesn't work with long filenames?
View 3 Replies
ADVERTISEMENT
Jul 20, 2005
HelloI am trying to execute ‘xp_cmdshell' from within a DTS package thatwas created by another person. When I try to execute that ‘SQL Task'selectively from within the package, I get the following errormessage:Error Title: Package ErrorError Details:Error Source: Microsoft OLE DB Provider for SQL ServerError Description: xpsql.cpp: Error 87 from GetProxyAccount on line604Why is this error message popping up? When I create a new package(myself) and create an exact same SQL task as above and run it, theSQL task runs fine.Appreciate any help / feedback.Thanks in AdvanceJagannathan Santhanam
View 1 Replies
View Related
Oct 14, 2004
Hi ,
I want to execute xp_cmdshell from normal sql server account not sysadmin member in SQL Server 2000. I had give execute privileges on xp_cmdshell to normal account... but its not working...
Is it possible to execute xp_cmdshell from non sysadmin member account in SQL Server2000...
Thanks in advance...
-Mohit.
View 1 Replies
View Related
Jan 11, 2008
Here is a post to the MSDN forums that I have not been able to resolve:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2663783&SiteID=1
Anyone here have any ideas?
View 6 Replies
View Related
Oct 22, 2007
How can I execute an SSIS package from TSQL without using xp_cmdshell?
I have a web-app which calls some SQL which executes my SSIS package (a DTSX file, but stored in the server). But the security policy for my application won't permit me use to xp_cmdshell.
I want to do this:-
DECLARE @returncode int
EXEC @returncode = xp_cmdshell 'dtexec /sq pkgOne"'
Is there another way for executing a Package without going to the command line (e.g. is there some other system stored proc)?
Thanks
View 1 Replies
View Related
Oct 22, 2007
How can I execute an SSIS package from TSQL without using xp_cmdshell?
I have a web-app which calls some SQL which executes my SSIS package (a DTSX file, but stored in the server). But the security policy for my application won't permit me use to xp_cmdshell.
I want to do this:-
DECLARE @returncode int
EXEC @returncode = xp_cmdshell 'dtexec /sq pkgOne"'
Is there another way for executing a Package without going to the command line (e.g. is there some other system stored proc)?
Thanks
View 14 Replies
View Related
Feb 10, 2006
I have a package that executes fine in BIDS. However, when calling it using xp_cmdshell it cannot find the path to the source flat file. Anyone have any suggestions?
Here is the statement:
xp_cmdshell 'dtexec /SQ NatlAcctsImport /SER CR1-SQL-01 /CONN SourceConnectionFlatFile;Q:BINATNLACCTS'
Here is the result:
Microsoft (R) SQL Server Execute Package Utility
Version 9.00.1399.06 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
NULL
Started: 9:50:56 AM
Progress: 2006-02-10 09:50:57.40
Source: Data Flow Task
Validating: 0% complete
End Progress
Progress: 2006-02-10 09:50:57.40
Source: Data Flow Task
Validating: 50% complete
End Progress
Progress: 2006-02-10 09:50:57.42
Source: Data Flow Task
Validating: 100% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Validating: 0% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Validating: 50% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Validating: 100% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Prepare for Execute: 0% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Prepare for Execute: 50% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Prepare for Execute: 100% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Pre-Execute: 0% complete
End Progress
Warning: 2006-02-10 09:50:57.43
Code: 0x80070003
Source: Data Flow Task Source - NATNLACCTS [1]
Description: The system cannot find the path specified.
End Warning
Error: 2006-02-10 09:50:57.43
Code: 0xC020200E
Source: Data Flow Task Source - NATNLACCTS [1]
Description: Cannot open the datafile "Q:BINATNLACCTS".
End Error
Error: 2006-02-10 09:50:57.43
Code: 0xC004701A
Source: Data Flow Task DTS.Pipeline
Description: component "Source - NATNLACCTS" (1) failed the pre-execute phase and returned error code 0xC020200E.
End Error
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Pre-Execute: 50% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Cleanup: 0% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Cleanup: 50% complete
End Progress
Progress: 2006-02-10 09:50:57.43
Source: Data Flow Task
Cleanup: 100% complete
End Progress
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 9:50:56 AM
Finished: 9:50:57 AM
Elapsed: 0.985 seconds
NULL
View 3 Replies
View Related
Jan 26, 2007
Hi,
I have a least privileged SQL Login €œClient€? and have granted execute rights on XP_Cmdshell SP at master db. When I execute master.. XP_Cmdshell €˜dir€™ I€™m getting the below error.
Msg 15153, Level 16, State 1, Procedure xp_cmdshell, Line 1
The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.
Please note it is SQL Login account and not windows account. I have checked everywhere for similar problem and no luck.
Thanks for you help in advance
With regards
GK
View 1 Replies
View Related
Mar 17, 2000
I have a stored proc that attempts to execute xp_cmdshell using a login other than 'sa'. The permissions have been given to the login to execute xp_cmdshell and the stored procedure executes perfectly within the query analyzer in EM. However, when attempting to execute the same stored proc in ISQL_W under a login with permissions for everything as dbo (other than Master) I get error 1326 for LogonUser on line 359. This is with the "xp_cmdshell - Use SQLExecutiveCmdExec Account for Non SAs" disabled (as described as a "workaround" on the technet). Microsoft acknowledged this as being a 'bug' to 'fix' and put a 'fix' in Service Pack 5a. The server that is experiencing this problem is running service pack 5. Is there any difference between the service packs and if so, will installing service pack 5a help me? And if not, what can be done to alleviate this problem?
View 1 Replies
View Related
Feb 26, 2001
I'm trying to run a .vbs file through the xp_cmdshell sp. It works fine, but if there's an error in the vbscript, the xp_cmdshell will just hang.
When I run the file from the command line, an error dialog box comes up expecting you to click ok. Sql just hangs waiting for this to be resolved.
Anyone have any ideas about how to get around this?
thanks
View 2 Replies
View Related
May 24, 2000
Hi everybody,
I am getting an error while running the XP_CMDSHELL 'NET USER /DOMAIN'.
But when I run the same command for sp_cmdshell 'net user' it works fine. It giving me the local users that are available on the my local pc. But now i want the domain users on my network which is not working with the xp_cmdshell..
Thanks in advance......
View 1 Replies
View Related
Jan 16, 2001
I'm trying to run a SQL Server 7.0 scheduled job that executes: Exec master..xp_cmdshell 'd:raining.bat'
If I run this in qry analyzer it runs fine. If I try to run it as a scheduled job it says 'can't find the specified file'
I'm a member of the sysadmins group and sqlexecagent is part of the NT admin group.
Can someone tell me how to fix this problem?
View 1 Replies
View Related
Nov 14, 2004
Hi all,
SQL Server 2000 SP3a, SAN Connection, Standard Edition, 2000 Server edition OS.
I've implemented a log shipping program on one set of sql servers already, the SVR1 set, which are working fine.
I am implementing this on the SVR2 set and I have the wrapperread() problem.
All using SP3a, with MDAC version outlined below. All are reported to be running the SP1 Refresh.
SVR1 - 2.7 SP1 Refresh
SVR1_DR - 2.7 SP1 Refresh
SVR2 - 2.7 SP1 / 2.7 SP1 Refresh
SVR2_DR - 2.7 SP1 / 2.7 SP1 Refresh
When executing the command below in T-SQL I get the error below.
EXEC @sentok = master.dbo.xp_cmdshell @cmd
[Microsoft][ODBC SQL Server Driver][Named Pipes]ConnectionRead (WrapperRead()).
Server: Msg 11, Level 16, State 1, Line 0
Any help would be gratefully accepted.
Regards,
JS
View 1 Replies
View Related
Jul 10, 2007
i am getting followig error while using xp_cmdshell
can anyone help regarding this
Message
Description: [SQL-DMO]The name 'SPS90HFD1DSQLServer2005MSFTEUser$RAJServer$MSSQL' was not found in the Users collection. If the name is a qualified name, use [] to separate various parts of the name, and try again. [SQLSTATE 01000] (Message 0) An error occurred during the execution of xp_cmdshell. A call to 'CreateProcess' failed with error code: '1455'. [SQLSTATE 42000] (Error 15121). The step failed.
View 3 Replies
View Related
Aug 28, 2007
I keep getting a "Incorrect syntax error near ' -Q''' " which is at the end of my xp_cmdshell line. What am I doing wrong?
CREATE Procedure dbo.sp_ImportRawData
(@ClientAbbrev nchar(4), @FileDate nvarchar(8), @SessionId nvarchar(50) )
AS
DECLARE @Msg varchar(255)
DECLARE @DataUpdates nvarchar(255)
DECLARE @Common nvarchar(255)
DECLARE @UServer nvarchar(255)
DECLARE @FullFileName nvarchar(68)
DECLARE @FileName nvarchar(64)
DECLARE @FileExt nvarchar(3)
DECLARE @SQL varchar(3500)
DECLARE @triFileName nvarchar(255)
Declare @Ip_FileName nvarchar(255)
Declare @Ip_Active char(1)
select @UServer = sd_value from Msysdata Where SD_Property = 'UpDateServer'
select @Common = sd_value from Msysdata WHERE SD_Property = 'CommonDir'
select @DataUpdates = sd_Value from Msysdata WHERE SD_Property = 'DataUpdate'
Set @UServer = @UServer + 'D$'
SET @Msg = 'Truncate tri_ active files'
EXEC MARS_SYS.dbo.sp_WriteLog @ClientAbbrev, 'UpdateMgr', @Msg, @FileDate, @SessionId
Declare ActiveFile Cursor For
Select Ip_FileName, Ip_Active from tbl_InputFiles
where Ip_Active = 'Y'
Open ActiveFile
Fetch Next From ActiveFile
Into @Ip_FileName, @Ip_Active
While @@Fetch_Status = 0
Begin
Exec('truncate table tri_'+ @Ip_FileName)
Set @FullFileName = @Ip_Filename + '.csv'
set @UServer = ''
set @Common = ''
set @triFileName = 'tri_' + @Ip_FileName
set @sql = 'master..xp_cmdshell ''' + @UServer + @Common + 'd:mars_syscommonscriptsodbcbcp -D CopyMedMgr10_Testing -i D:mars_sysdataupdatesccbm' + @FullFileName + ' -Q''' + @triFileName
exec(@SQL)
Fetch Next From ActiveFile
Into @Ip_FileName, @Ip_Active
End
CLOSE ActiveFile
DEALLOCATE ActiveFile
View 8 Replies
View Related
Jul 23, 2005
I am getting the following error when running a command in QueryAnalyzer.Msg 50001, Level 1, State 50001xpsql.cpp: Error 5 from CreateProcess on line 675Here is the command that I am running that generates this errormessage:xp_cmdshell "@ECHO test message > c: empewtemp.txt"The command inside the xp_cmdshell command runs successfully from aWindows command prompt. Simpler commands also fail with the same errormessage. For example:xp_cmdshell 'dir'Can anyone suggest a solution to this problem? I assume this problem isdue to a permissions/security issue. I have given Everyone Full Controlover c: emp.Windows 2000SQL Server 2000Thanks for any help.
View 4 Replies
View Related
Nov 28, 2006
EXEC xp_cmdshell 'dir *.exe'
Msg 50001, Level 1, State 50001
xpsql.cpp: Error 1326 from LogonUserW on line 620
I have followed following document completely with no problem but yet system generate above error
http://www.support.microsoft.com/kb/890775
before that I used to get following error that is one of the described scenario in that document
Msg 50001, Level 1, State 50001
xpsql.cpp: Error 87 from GetProxyAccount on line 499
Configuration:
SBS2000 Premium (Includes SQL 2000)
User: a regular with PUBLIC access on MASTER
View 4 Replies
View Related
Sep 24, 2015
Got this error running a query with ssms2014
on SqlServer2014
but db has Compatibiliy level 100 (sql2008)
no sql error code in message and no error found in eventviewr (sqlserver log, windows log, application log ecc)when i run that query i got this message in "messages" tab, and in results tab i got a strange result, indeed the value returned doesn't exists in table.
ex table1.field1 possible values= 2,3
it returns 1113344
we got that error thru jdbc too...that query use a lot of joins, unfortunatley i can't post it here. today got this error, so i make a copy of 1 of involved table into another db in the same instance, re run the query on the original db, and it works well.
View 2 Replies
View Related
Jan 23, 2008
Hi,
I'm having an SSIS package which gives the following error when executed :
Error: 0xC002F210 at Create Linked Server, Execute SQL Task: Executing the query "exec (?)" failed with the following error: "Syntax error or access violation". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.Task failed: Create Linked Server
The package has a single Execute SQL task with the properties listed below :
General Properties
Result Set : None
ConnectionType : OLEDB
Connection : Connected to a Local Database (DB1)
SQLSourceType : Direct Input
SQL Statement : exec(?)
IsQueryStorePro : False
BypassPrepare : False
Parameter Mapping Properties
variableName Direction DataType ParameterName
User::AddLinkSql Input Varchar 0
'AddLinkSql' is a global variable of package scope of type string with the value
Exec sp_AddLinkedServer 'Srv1','','SQLOLEDB.1',@DataSrc='localhost',@catalog ='DB1'
When I try to execute the Query task, it fails with the above error. Also, the above the sql statement cannot be parsed and gives error "The query failed to parse. Syntax or access violation"
I would like to add that the above package was migrated from DTS, where it runs without any error, eventhough
it gives the same parse error message.
I would appreciate if anybody can help me out of this issue by suggeting where the problem is.
Thanks in Advance.
View 12 Replies
View Related
Aug 7, 2007
some one can tell if i can make a "where" clause inside the BCP , when i say : select * FROM tbl where flag=N , usually the where flag='N' works with the ' ' , but it gives no error when save the store procedure without it ' ' saves nicely the SP,
but
like this it saves well "SELECT * FROM tbl where flag=N" and
when i execute it, give a sql statement error "Error = [Microsoft][SQL Native Client][SQL Server]Invalid column name N."
i dont now , any help
PS: perhaps at the end of the BCP ---> -c -T , must have some more or less
View 5 Replies
View Related
Mar 13, 2006
BCP thru xp_cmdshell from stored procedure:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE
EXEC xp_cmdshell 'bcp database.dbo.table in c:scheduled.csv -S SERVERSQLEXPRESS -T -t, -r -c -e "error.txt"';
This is returning the following error code. I even tried placing the command in a seperate command file and calling that with no success. If I run this from the command line the error file generation does work.
=================================================================
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unable to open BCP error-file
=================================================================
Error message when using BULK INSERT as follows:
BULK INSERT database.dbo.table from 'c:unscheduled.csv' with
(FIELDTERMINATOR = ',', ERRORFILE = 'c:error.txt');
Returns the following error message:
=================================================================
Msg 4861, Level 16, State 1, Procedure pro_cedure, Line 9
Cannot bulk load because the file "c:error.txt" could not be opened. Operating system error code 80(The file exists.).
Msg 4861, Level 16, State 1, Procedure pro_cedure, Line 9
Cannot bulk load because the file "c:error.txt.Error.Txt" could not be opened. Operating system error code 80(The file exists.).
=================================================================
The Bulk Insert actually creates a empty error.txt file (0kb) and never preforms the insert, I can not find any examples of anyone using the -ERRORFILE switch on BULK INSERT. Prolly some default security setting to allow file creation/modification I am missing. Anyone help me out? Thanks.
EDIT: SQL SERVER EXPRESS 2005 - WINXP PRO SP2
View 1 Replies
View Related
Mar 28, 2006
I get this error when trying to run xp_cmdshell. I have turned on xp_cmdshell via sp_configure and verified it is on (set to 1) by running sp_configure again. The login trying to run xp_cmdshell has sysadmin privileges. If anyone has a solution please let me know.
View 8 Replies
View Related
Feb 28, 2008
I am getting this error
An error occurred while executing batch. Error message is: The directory name is invalid."
in sql management studio.
i found that if i switch to results to text i don't get the error but with results to grid I get it no matter what i query in any database on the server.
View 2 Replies
View Related
Apr 3, 2008
Hi all
my problem is as follows : when i try to configure an ODBC DataAdapter using the configuration wizard
i use the query builder to select some fields from multiple tables , the displayed info depends in a user input , when i define the input parameter by writing(= ?) in the criteria column of the input field and continues , it displays an error
Error H4000 Error while executing the query , Error near ')' near character (214 for example).
so please if any one knows the solution to this error reply soon
Thanks a lot
Mina Samy
View 3 Replies
View Related
Apr 24, 2003
I am facing this error when using a SP called by a DTS package (using ADO connection).
The SP gets three parameter and looks like the following (just major part of it):
SET @STR = 'SET ROWCOUNT 10000' + ' WHILE 1 = 1 ' + 'BEGIN' + ' BEGIN TRAN'
SET @STR = @STR + ' DELETE FROM ' + @TableToBeCleaned + ' WHERE ' + @SELECTEDCOLUMN + ' <
DATEADD (m,' + ' -' + @KeepMonthsInDatabase + ', + GETDATE())'
SET @STR = @STR + 'IF @@ROWCOUNT = 0 ' + 'BREAK ' + 'COMMIT ' + 'END ' + 'SET ROWCOUNT 0'
EXEC (@str)
Following error appears:
Server: Msg 266, Level 16, State 2, Line 1
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing.
Previous count = 4, current count = 5.
Server: Msg 266, Level 16, State 2, Procedure p_DBCleanerDeleteRows, Line 56
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing.
Previous count = 4, current count = 5.
I use the SET ROWCOUNT to execute the delete in batches. When checking with SELECT @@TRANCOUNT it
returns me 5. Somehow it is clear to me that @@TRANCOUNT exited the SP with another value than when
entering it but there is commit in the dynamic SQL statement and I do not know what is wrong.
Is it neccessary to indicate BEGIN TRAN and COMMIT in the statement at all or can I ommit it?
Thanks
mipo
View 1 Replies
View Related
Jul 23, 2005
Perhaps this has already been answered. If so, I apologize. I'm anewbie at this stuff. I have a DTS package to import some VisualFoxpro data. Yes, I said Visual Foxpro. :) The DTS package worksbeautifully when I rightclick on the package and choose "execute." Andit works beautifully when I run dtsrun.... at the DOS prompt. But itdoesn't work when I try to execute it with code in Query Analyzer.I've tried exec master..xp_cmdshell 'dtsrun ...' And I've triedscheduling the package as a Job, disabling the Job and then usingmsdb..sp_start_job to run it. Neither of those work.I get a "DSN not found and no default driver specified."My DSN stuff looks OK to me, but perhaps some of that is wrong. Whatdoes the DSN have to look like in order for the code in Query Analyzerto find it? If the DSN is screwed up, why would it work OK whenexecuted from some places, but not in others? What am I missing?Any help would be much appreciated. :) thanks...-emily
View 3 Replies
View Related
Feb 9, 2007
Hello,
I hope this forum is suitable for posting my question.
I have a site in asp and vb with an access database. It's work just fine. I want to convert my database from access to mssql express. So I convert it with Microsoft SQL Server Migration Assistant for Access. I also install mssql server on my computer, so I can test my site at home.
But now, I have trouble, I've received many errors like:
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '#'.
(this appear when I try to insert date and time in database, witch in access database I have no problem)
ODBC driver does not support the requested properties
(this appears when I make a selection in database, where I use inner join).
And many more ...
Do I have to rewrite the code to all my files? It's so different working with MSSQL comparing with Access database?
From what I read, I understand that after converting the database from Access to MSSQL, I must change only the connection string and the site have no problem. But it seems it's not so easy. I'm pretty disappointed.
Can you give me an advice? Or some links where I can read something that can help me.
Thanks.
View 4 Replies
View Related
Apr 17, 2007
when i try to run a procedure i've been working on, i get the following Error:
Server: Msg 8144, Level 16, State 2, Line 0
Procedure or function has too many arguments specified.
execution code:
exec search_orders_1 @dwelltype=1
stored procedure:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER PROCEDURE search_orders_1
@lowageint=null,
@highageint=null,
@highwealthint=null,
@lowwealthint=null,
@highpurpriceint=null,
@lowpurpriceint=null,
@lowmtgamtint=null,
@highmtgamtint=null,
@lowincomenvarchar(4000)=null,
@highincomenvarchar(4000)=null,
@marriedstatnvarchar(4000)=null,
@lowyearbuildnvarchar(4000)=null,
@highyearbuildnvarchar(4000)=null,
@mtgpresstatnvarchar(4000)=null,
@lenderpresstatnvarchar(4000)=null,
@ratetsnvarchar(4000)=null,
@loantsnvarchar(4000)=null,
@childstatnvarchar(4000)=null,
@homeownerstatnvarchar(4000)=null,
@lowpurdatenvarchar(4000)=null,
@highpurdatenvarchar(4000)=null,
@addresstype varchar(3)=null,
@SPSirvarchar(3)=null,
@debttypevarchar(3)=null,
@dwelltypevarchar(3)=null,
@zipselectnvarchar(4000)=null,
@acselectnvarchar(4000)=null,
@stselectnvarchar(4000)=null,
@cityselectnvarchar(4000)=null,
@counselectnvarchar(4000)=null,-- as
@debug bit = 0 AS
DECLARE @sql nvarchar(4000),
@paramlist nvarchar(4000)
SELECT @sql ='SELECT o.state_abbrv, count(o.state_abbrv) as kount FROM dbo.mortgage o WHERE 1 = 1'
IF @lowage<>0 and @lowage is not null
SELECT @sql = @sql + ' AND o.per1_age >= @xlowage'
IF @highage<>0 and @highage IS NOT null
SELECT @sql = @sql + ' AND o.per1_age <= @xhighage'
IF @lowincome<>'DF' and @lowincome IS NOT NULL
SELECT @sql = @sql + ' AND o.est_inc >= @xlowincome'
IF @highincome<>'DF' and @highincome IS NOT NULL
SELECT @sql = @sql + ' AND o.est_inc <= @xhighincome'
IF @highwealth<>0 and @highwealth IS NOT NULL
SELECT @sql = @sql + ' AND o.wealth_rating <= @xhighwealth'
IF @lowwealth<>0 and @lowwealth IS NOT NULL
SELECT @sql = @sql + ' AND o.wealth_rating >= @xlowwealth'
IF @highpurprice<>0 and @highpurprice IS NOT NULL
SELECT @sql = @sql + ' AND o.hm_purprice <= @xhighpurprice'
IF @lowpurprice<>0 and @lowpurprice IS NOT NULL
SELECT @sql = @sql + ' AND o.hm_purprice >= @xlowpurprice'
IF @lowyearbuild<>'DF' and @lowyearbuild IS NOT NULL
SELECT @sql = @sql + ' AND o.hm_year_build >= @xlowyearbuild'
IF @highyearbuild<>'DF' and @highyearbuild IS NOT NULL
SELECT @sql = @sql + ' AND o.hm_year_build <= @xhighyearbuild'
IF @lowmtgamt<>0 and @lowmtgamt IS NOT NULL
SELECT @sql = @sql + ' AND o.oo_mtg_amnt >= @xlowmtgamt'
IF @highmtgamt<>0 and @highmtgamt IS NOT NULL
SELECT @sql = @sql + ' AND o.oo_mtg_amnt <= @xhighmtgamt'
IF @lowpurdate<>'DF' and @lowpurdate IS NOT NULL
SELECT @sql = @sql + ' AND o.hm_purdate >= @xlowpurdate'
IF @highpurdate<>'DF' and @highpurdate IS NOT NULL
SELECT @sql = @sql + ' AND o.hm_purdate <= @xhighpurdate'
IF @marriedstat in ('M','S')
SELECT @sql = @sql + ' AND o.per1_ms = @xmarriedstat'
IF @ratets in ('V','F')
SELECT @sql = @sql + ' AND o.oo_mtg_rate_t = @xratets'
IF @homeownerstat in ('H','R')
SELECT @sql = @sql + ' AND o.homeowner = @xhomeownerstat'
IF @childstat in ('Y','N')
SELECT @sql = @sql + ' AND o.child_pres = @xchildstat'
IF @lenderpresstat ='Y'
SELECT @sql = @sql + ' AND o.oo_mtg_lender_name<>+ '' '''
IF @lenderpresstat ='N'
SELECT @sql = @sql + ' AND o.oo_mtg_lender_name=+ '' '''
IF @mtgpresstat='Y'
SELECT @sql = @sql + ' AND o.oo_mtg_amnt>0'
IF @mtgpresstat='N'
SELECT @sql = @sql + ' AND o.oo_mtg_amnt=0'
IF @loants<>'DF' and @loants IS NOT NULL
SELECT @sql = @sql + ' and o.oo_mtg_loan_t in ( ''' + REPLACE( @loants, N',', N''',''' ) + N''' )'
if @dwelltype='1'
SELECT @sql = @sql + ' and o.addr_unit_desnum='' '''
if @dwelltype='2'
SELECT @sql = @sql + ' and o.addr_unit_desnum<>'' '''
if @acselect <> 'DF' or @stselect <> 'DF' or @cityselect <> 'DF' or @counselect <> 'DF' or @zipselect <> 'DF'
SELECT @sql = @sql + ' and (1=2'
IF @acselect<>'DF' and @acselect IS NOT NULL
SELECT @sql = @sql + ' OR o.areacode in ( ''' + REPLACE( @acselect, N',', N''',''' ) + N''' )'
IF @stselect<>'DF' and @stselect IS NOT NULL
SELECT @sql = @sql + ' OR o.state_abbrv in ( ''' + REPLACE( @stselect, N',', N''',''' ) + N''' )'
IF @cityselect<>'DF' and @cityselect IS NOT NULL
SELECT @sql = @sql + ' OR o.citystate in ( ''' + REPLACE( @cityselect, N',', N''',''' ) + N''' )'
IF @counselect<>'DF' and @counselect IS NOT NULL
SELECT @sql = @sql + ' OR o.countystate in ( ''' + REPLACE( @counselect, N',', N''',''' ) + N''' )'
IF @zipselect<>'DF' and @zipselect IS NOT NULL
SELECT @sql = @sql + ' OR o.zip in ( ''' + REPLACE( @zipselect, N',', N''',''' ) + N''' )'
if @acselect <> 'DF' or @stselect <> 'DF' or @cityselect <> 'DF' or @counselect <> 'DF' or @zipselect <> 'DF'
SELECT @sql = @sql + ')'
SELECT @sql = @sql + ' group by o.state_abbrv ORDER BY o.state_abbrv '
IF @debug = 1
PRINT @sql
SELECT @paramlist = '@xlowageint,
@xhighageint,
@xlowincomenvarchar(4000),
@xhighincomenvarchar(4000),
@xmarriedstatnvarchar(4000),
@xhighwealthint,
@xlowwealthint,
@xhighpurpriceint,
@xlowpurpriceint,
@xlowyearbuildnvarchar(4000),
@xhighyearbuildnvarchar(4000),
@xlowmtgamtint,
@xhighmtgamtint,
@xmtgpresstatnvarchar(4000),
@xlenderpresstatnvarchar(4000),
@xratetsnvarchar(4000),
@xloantsnvarchar(4000),
@xchildstatnvarchar(4000),
@xhomeownerstatnvarchar(4000),
@xlowpurdatenvarchar(4000),
@xhighpurdatenvarchar(4000),
@xzipselectnvarchar(4000),
@xacselectnvarchar(4000),
@xstselectnvarchar(4000),
@xcityselectnvarchar(4000),
@xcounselectnvarchar(4000)'
EXEC sp_executesql @sql, @paramlist,
@lowage,
@highage,
@lowincome,
@highincome,
@marriedstat,
@highwealth,
@lowwealth,
@highpurprice,
@lowpurprice,
@lowyearbuild,
@highyearbuild,
@lowmtgamt,
@highmtgamt,
@mtgpresstat,
@lenderpresstat,
@ratets,
@loants,
@childstat,
@homeownerstat,
@lowpurdate,
@highpurdate,
@addresstype,
@SPSir,
@DebtType,
@DwellType,
@zipselect,
@acselect,
@stselect,
@cityselect,
@counselect
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
could someone help me figure out what's up? someone told me you can have 1,024 parameters for a stored procedure.... what am i missing?
do i have to many IF clauses?
View 2 Replies
View Related
Nov 28, 2006
Hi,
I get the following error while trying to execute a UDF.
Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user defined routine or aggregate 'test':
System.NullReferenceException: Object reference not set to an instance of an object.
System.NullReferenceException:
at SalesCentral_Database.UserDefinedFunctions.udfTest()
My function is defined as follows:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Partial Public Class UserDefinedFunctions
<Microsoft.SqlServer.Server.SqlFunction(DataAccess:=DataAccessKind.Read)> _
Public Shared Function udfTest() As SqlString
SqlContext.Pipe.Send(System.DateTime.Now().ToString())
Dim conn As New SqlConnection("context connection=true")
conn.Open()
Dim cmd As New SqlCommand("SELECT MAX(ACCTPERIOD) FROM TBL_OPPORTUNITY_HIS", conn)
Return New SqlString(cmd.ExecuteScalar().ToString())
End Function
End Class
SQL Server
CREATE ASSEMBLY SalesCentral_Database from '\isew5l6c ranfSFS_SalesSalesCentral_Database.dll' WITH PERMISSION_SET = SAFE
CREATE FUNCTION test() RETURNS NVARCHAR(10) AS EXTERNAL NAME [SalesCentral_Database].[SalesCentral_Database.UserDefinedFunctions].[udfTest]
SELECT dbo.test()
- Here I get the error mentioned above. Can anyone please tell me what am I missing.
Thanks.
View 3 Replies
View Related
Feb 22, 2008
This is the error I get if the login "reports" does not exist on the destination server
Error: The Execute method on the task returned error code 0x80131500
(ERROR : errorCode=-1073548784 description=Executing the query
"EXEC dbo.sp_grantdbaccess @loginame = N'reports', @name_in_db = N'reports' "
failed with the following error: "'reports' is not a valid login or you do not
have permission.". Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or connection not established
correctly. helpFile= helpContext=0 idofInterfaceWithError=
{8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}). The Execute method must succeed, and indicate
the result using an "out" parameter.
This is the error I get if the login "reports" does exist on the destination server
Error: The Execute method on the task returned error code 0x80131500
(ERROR : errorCode=-1073548784 description=Executing the query "EXEC
dbo.sp_grantdbaccess @loginame = N'reports', @name_in_db = N'reports' "
failed with the following error: "User, group, or role 'reports' already
exists in the current database.". Possible failure reasons: Problems with the
query, "ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly. helpFile= helpContext=0
idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}). The Execute
method must succeed, and indicate the result using an "out" parameter.
What am I doing wrong ?
View 3 Replies
View Related
Jan 17, 2008
Hello,
Today we succesfully integrated Report Services with Sharepoint services.After that I was trying to implement the reports we made in Report Services into the Sharepoint site.The first report was ok, everything went well, no errors and the report was succesfully executed.Then the second report, it is a bit a bigger and more advanced report.It also has to be executed at an other server.I am going to explain how the server setup is.We have 2 servers, a x32 and a x64 server.The x64 server is the "Live" server, and the x32 is our "Test" server.On the x32 server we have MS SQL Server 9.0.3200 (SP2), it is the same as on the x64 server.When i try to execute the report on the x32 server, I got an error.The error I get from reporting server is:
An internal error occurred on the report server. See the error log for more details.So I checked the error log, and then I got the following message:
EventType sql90exception, P1 w3wp.exe, P2 6.0.3790.3959, P3 45d6968e, P4 reportingservicesnativeclient.ni.dll, P5 2005.90.3042.0, P6 45cd6edb, P7 0, P8 00005283, P9 00000000, P10 NIL.For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
After I had found the error, I had searched on Google what the message means.
I found some topics on other forums that said "Install SP2".
But that was not an option since we are on SP2.
Some additional information:
Just tried to run the first report on the x32 server, and it worked.
So the first report runs on the x32 as the x64 server.
Can someone tell me what to do?
Thanks,
Rens
View 3 Replies
View Related
Jan 24, 2007
Hello, I finally could upload the package, and from the management studio interface I ran the package and it worked perfectly.
When I created a job, with one step only to execute that package, the job fails.
When I go to history it doesnt give me any details of what failed on the package or in the job
Date 24/01/2007 12:30:28
Log Job History (Carga datos ACH)
Step ID 1
Server ATLANTESQL2005
Job Name Carga datos ACH
Step Name Carga de datos de ach
Duration 00:00:02
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
Executed as user: ATLANTESYSTEM. The package execution failed. The step failed.
Maybe is the user that it tried to execute the package as?
How can I change it?
View 5 Replies
View Related
May 17, 2006
I wrote package using Integration Services and tried execute it on Visual Studio 2003 (Visual Basic). Package was loaded, but execute method has failed without any error messages. When I tried to run it on Visual Studio 2005, execution was successful.
Codes:
Dim App As DTSLib.IDTSApplication90 = New DTSLib.Application
Dim p As DTSLib.IDTSPackage90 = App.LoadPackage("d: empPackage.dtsx", True, Nothing)
p.Execute()
What can be the reason of the trouble?
Thanks,
Alexander
View 1 Replies
View Related