MSSQL Stored procedure : only one command executed
For a MSSQL Stored Procedure, We have used this
Solution1:
Just put SET NOCOUNT OFF in the end of the stored procedure. After that run the stored procedure in the Desktop Intelligence report.
Or
If the above doesnu2019t works then please try the following solution.
Solution2:
You have to add the given parameter in .sbo file -> save the file and run the stored Procedure.
This file should be located under <drive>\Business Objects\BusinessObjects Enterprise 11.5\dataAccess\RDBMS\connectionServer\odbc\odbc.sbo
<Defaults>
<Parameter Name="Force SQLExecute">Always</Parameter>
but it still does not work
What others?
Hello
thank you for your answer but indicated procedure to test does not work too
the message is the same : u201CNo column and no data to fetchu201D
I return with more details :
to create a new report DesKi, I use this stored procedure
CREATE PROCEDURE dbo.test1 @matricule integer
AS
BEGIN
SET NOCOUNT OFF
delete from Temp_matr_boucle
execute absences_matricules_per_matr @matricule /* it is ok */
select MATRICULE ,NOM ,PRENOM ,CDDEP, NBR_PERIODE, NBR_JOURS , UNITE ,
DATE_MIN, DATE_MAX ,TYPE_ABSENCE, MATRICULE_CAR, NBR_JOURS_SERVICES
from Temp_matr_boucle as result /* not execute */
return
END
Launched directly from the database it work verry well.
Launched in Deski rapport, we get the same message
u201CNo column and no data to fatchu201D
The exec command works because the table "Temp_matr_boucle" is filled but is no longer running the select commande.
You have advisor to use one a two solutions (see replay from DWinkel)
1) SET NOCOUNT OFF
or
2) add the parameter:
<Defaults>
<Parameter Name="Force SQLExecute">Always</Parameter> in odbc.sbo file
Note that we use the OLEDB driver and not the odbc
We all tried both but the result is the same
thank you for your help
regards
Mariana
Similar Messages
-
How to run stored procedure in DOS command line????
Hi,
I want to run a stored procedure in DOS command line?
(My_Stored_Procedure is the stored procedure that I want to run )
This is what I did in DOS prompt
C:\>sqlplus scott/tiger exec lMy_Stored_Procedure <Return>
Obviously it is NOT working. Please send me the correct way to fix this.
Thanks so much in advance for helping.
CuongBilly Verreynne wrote:
BluShadow wrote:
True Billy, but even Windows hasn't completely got away from using the "DOS" word...Yeah - the command line/shell environment is based on that of the old DOS command interpreter. But Microsoft does not make the mistake of call it DOS.
In fact, with earlier versions of Windows NT, a 16bit DOS real-mode virtual machine was supported. This was very kewl.
Running a large BBS with multiple nodes back then required a DOS machine per node, an IPX network, and a Novell file server.Novell Netwars. ;)
Ahhhh! good old DOS... so many good programs written at that low level, outside the Windoze environment.Yeah.. cut my teeth on writing code for DOS. Still have all my old BIOS and assembler manuals for it. Wrote my own screen s/w (write to a buffer and then move it into the video buffer, instead of writing char wise to the video buffer via interrupts), mucking about with my own concurrent threading model (using very simplistic cooperative multitasking) and so on. Heck, wrote tons of s/w on DOS... :-)Yeah I've still got a copy of my old machine code programs for writing to buffers and screen memory switching for smooth animation. Run them nowadays and they run like sh!t off a shovel. And all my old coursework including writing an interpreted language and multi-window (dos based windows) editor, parser and the code to execute the language and display the output. Oooo, and so much other stuff.
Awesome back then as you got really intimate with the o/s and hardware. This is sorely lacking today in environments like Java. And I think the reason why so much code written today is less than optimal - to put it kindly.Exactly. Started for me on the Sinclair zx81 (writing Basic), then the Sinclair Spectrum (Basic and Assembly), then Sinclair QL (yes I really had one!) and then the BBC Master 128K (where I got to writing my own rom filing system and creating my own eproms, to integrate with the word processor for additional printing features etc. as well as storing games on rom for speedy loading - and I still have it and it still works!)
It's that level of working with the underlying memory and assembly language that gives you the understanding of how values are passed between code using the stack and registers, and how memory allocation and referencing is done etc. As you say... it's missed in a lot of todays teaching, which just seems too high level and misses the basic concepts of things such as datatypes and why they are different. I bet half the modern programmers wouldn't have a clue how to do multiplication or division of binary numbers using the carry flag. -
How to convert MSSQL stored procedure to PostgreSQL
Hi,
Anyone can help me...?
How to convert MSSQL stored procedure to PostgreSQL function?
Is there any tool available to convert T-SQL from MSSQL to PostgreSQL?
Thanks in advanceHello
Here, I write one sample stored procedure of SQL Server which I need to convert into PostgreSQL. Please help me in this with PostgreSQL.
Thanks in advance.
Below is sample SQL Server stored procedure: require to convert into PostgreSQL stored procedure
CREATE PROCEDURE [dbo].[usp_GetData_ByTableName]
@TableName NVARCHAR(MAX)
,@IncludeKeepAlive BIT
,@RowsAffected BIGINT=0 OUTPUT
) AS
BEGIN
SET NOCOUNT ON
DECLARE @SQL VARCHAR(MAX)
Select data base on parameter.
SET @SQL =
SELECT *FROM '+@TableName+'
WHERE 1=1
+
CASE WHEN (@IncludeKeepAlive = 0)
THEN
AND [MessageTransactionID] <> 152
ELSE
END
EXECUTE SP_EXECUTESQL @SQL
RETURN 0 -
How to call MSSQL stored procedure from oracle database
MSSQL and Oracle databases are linked thru ODBC link using Oracle HSODBC.
I can query MSSQL table or view from Oracle Database using standard notation for acessing remote objects schema.object@dblink_name...
Can anybody give me syntax for calling MSSQL stored procedure thru ODBC database link?
I tried syntax exec schema.stored_procedure@dblink_name but it doesn't work...i'm getting schema.stored_procedure must be declared error...
Tnx,in advance!
Dejan BoticaOracle database 10gR2.
MSSQL2000 database.
For example query:
select * from dbo.Tbl_Test@kron@dw_jamnica; works fine...
...while for example exec dbo.Test@kron@dw_jamnica;
reports error:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBO.TEST@KRON@DW_JAMNICA' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Table Tbl_Test and procedure Test exists in MSSQL instance.
Regards,
Dejan -
Java Stored Procedure in one database connecting to muntiple databases.
Hello,
I created a Java Stored Procedure in one database(Oracle10g) and successfully open a connection to another database(Oracle10g) using Thin JDBC Driver. I want to actually transfer CLOB data from one DB to another DB. I am concern that by opening a connection another database in Java Stored Procedure, might interfere with oracle and destabilize the instance at some point. Oracle JDBC FAQ (Link: http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#34_13) stated that Yes it could be done but then mentioned the workaround.(if it could be done why do we need a workaround!!!)
I would like to confirm whether connecting to multiple DB using JDBC Thin Driver in a Java Stored Procedure is supported by Oracle10g or not and whether it has any known issue with it.
Thanks in Advance!
Edited by: user649261 on Sep 16, 2008 8:05 PMhrishy wrote:
Thanks i have modified the title so its easy to comprehendWrite the two parts mentioned above and post if you get problems with your code.
First write code that calls the stored procedure and test that to make sure that it works.
Then write a simple webservice and test it out to make sure it works. The integration should be trivial after that. -
How to set role which can issue only one command
I am thinking about setting role, which will be allowed to issue olny one command. I have created role test. Which has the following entries in the following files:
/etc/user_attr
test::::profiles=OneCommand;type=role
/etc/security/exec_attr
OneCommand:solaris:cmd:::/tmp/data.sh:euid=0
After this I sill could issue all comands, not only test command /tmp/data.sh.
When I issued comand profiles on test role I received the following:
bash-3.00$ profiles test
OneCommand
Basic Solaris User
All
So I commented line in the /etc/policy.conf to read:
#PROFS_GRANTED=Basic Solaris User
After that, when I try to issue /tmp/data.sh command as a test role I receive the following error:
$ /tmp/data.sh
pfexec: Exec format error
Does anybody know how to set up the role which can issue only one command ? Maybe there is a way to do this in the way which wil not affect another roles (ie, not to touch /etc/policy.conf).
Best regardsRadekW wrote:
I am thinking about setting role, which will be allowed to issue olny one command. I have created role test. Which has the following entries in the following files:They will need the ability to run at least a profile shell otherwise all bets are off. So now you're down to two commands. :-)
bash-3.00$ profiles test
OneCommand
Basic Solaris User
AllFirst you need to define what already exists by default. (policy.conf)
Then you get to change those defaults or create a new default list just for test.
Then you get to add a role or profile for test that allows the execution of a profile shell and one command.
Then you should test all of the user accounts to ensure that something didn't break. This step might be a little overkill.
alan -
MSSQL stored procedures to Oracle migration
I am working on a migration from MSSQL2K to Oracle 10g. I have used the Oracle Migration Workbench to do the initial conversion, and I am having to do a ton of by hand conversion. There are some stored procedures that the OMWB did not bring over at all, however.
Does anybody know of a utility that can take a single MSSQL stored procedure and convert it to a Oracle PL/SQL procedure or function? I am somewhat tired of doing entire procedures by hand. It is very tedious.
wallyWally, there is a process to this kind of migration. In a lot of instances the OMWB will not map some of your stored procedures and hence, at the end of the migration you will see them as missing. Go back to the Source model view and using the log window, filter so you just see the errrors. Comment out the offending statements and right click on the object to parse it again. If it is correct it will appear in the Oracle Model. Once it has appeared there it will be generated into your Oracle database. However, you may still need to verifiy that you have got equivilence by testing the procedure.
-
I have made stored procedures for an app, and i would like to
know how to prevent all the system SPs from showing up in the
Stored procedure tree. I think i need to create a schema for the
db?
Using CS3 on VIsta U and MSSQL 2005 ExpressMikeL7 wrote:
> I have made stored procedures for an app, and i would
like to know how to
> prevent all the system SPs from showing up in the Stored
procedure tree. I
> think i need to create a schema for the db?
> Using CS3 on VIsta U and MSSQL 2005 Express
>
It sounds like your using an SQL login that has rights to see
all the
system SPs.
When I create web applications I always create an SQL user
for the web
pages, one which only has GRANT rights to the stored
procedures the
website needs. I also have an admin SQL user for the website
admin
pages, this user will have more rights and will be able to do
deletes or
inserts on particular tables.
Never ever ever use SA in your webpages to connect to your
SQL server,
if your site gets compromised via SQL injection then they
will have
complete control over it. Trust me on this one, its happened
to me, and
I had to learn the hard way by formatting the server and
reinstalling
everything, and setting up everything again. My boss was not
impressed
with me!
Steve -
How do i fire a query/Stored procedure only once
Hi,
I have a master frame and multiple child frames. Master frame triggers child1 frame which triggers child 2 frame etc using some common keys between the frame.
Now each frame executes a stored procedure and then uses the Db2 cursor as a record set. However when the same frame is fired again then the stored procedure is triggered again. But i could very well use the same record set from the record set that i already have,
In other words i need to fire the stored procedure/query only once and not every time the frame is fired.
I just need to get the record set for each frame and then operate on the retrieved record sets.
Is there a way to do this?
Currently I experience serious performance issues as the stored procedures get fired repeatedly thousands of times
Any help will be greatly appreciated
Thanks
anandI am still haveing problems so I will try and attach my program and see if you can help a little more that. It will probably be easier for you to look at this way. When you look at the diagram sequence 0 is the one the problem is in. In that sequence you will see a case structure and that is where the finite pulse train vi is. When case 1 is selected the finite pulse train will run again and again until I leave case 1. I need to have the program run the finite pulse train once and then wait and do nothing until the case is changed. The finite pulse train will be in all cases inside the case structure I just haven't done that yet, I am waiting until it works. The pulse train is used to move a stepper motor that is why running only once is im
portant because the stepper motor is used to position something.
Attachments:
AMC_Eagle_Both_Inputs_Working_2.vi 266 KB -
Sending data to mssql stored procedure that accepts variable of text data
Hi all
i have a stored procedure in mssql 2000 whole input parameter is of type text
how can i send data of type string from java class while calling storedprocedure using callable statement
if ui use setString() function it gives an exception that data will be trunctated
com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.sendExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(Unknown Source)
at com.clearcube.util.DMLLayer.processClientRequest(DMLLayer.java:49)
at com.clearcube.discovery.PushDiscoveryHandler.init(PushDiscoveryHandler.java:90)
at com.clearcube.discovery.PushDiscoveryController$1.run(PushDiscoveryController.java:113)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
c
if any one have solution to this problem plz reply memy stored procedure accepts input of type text
i use text type becouse nvarchar is not enough to
place data.
and i want to send data that is greater than the
length of varcharUnder setString in the API:
"The driver converts this to an SQL VARCHAR or LONGVARCHAR value (depending on the argument's size relative to the driver's limits on VARCHAR values) when it sends it to the database."
I am not sure what you should use then? Maybe setCharacterStream? -
Job with Multiple Schedule of same time & only one is executed, Why
Hi ALL,
I've Created a package to notify report in email as excel, which is using a path to render report and save it as excel.
This package was need to be schedule every first day of month and on every Friday even at morning 7 AM.
So logically these are two events.
But if we see on 1 May 2015 we have Friday and plus first day of month
So technically this should fail.
either for IO operation for render &
storing data over same location with same file name.
To replicate this i created two three schedule
Below is the job history, job is invoked by only one schedule
Question-
1) Why one one schedule execute?
2) why "sched2" only , it could be "sched3" only or "DentalOperationStackAndRank-Sched1" Only?
Another this i result into error if different job executing same package at same schedule.
FYI- package is deployed at database level
HSHi HS,
As described in this
article, more than one job can run on the same schedule, and more than one schedule can apply to the same job.
And I make a test about your scenario, when configuring a SQL Server job with three schedules that reference same dates and times, my job behaves as yours that only one schedule is executed, but the job is invoked by schedule2 or schedule 3 in my environment.
It is a normal behavior of SQL Server job in my opinion. For more details about such scenario, you can track the job following this
blog.
However, when I configure three jobs that run on the same schedule, everything works well and the three jobs all run successfully.
I recommend you configure three different jobs that execute same package at same schedule .
Thanks,
Lydia Zhang
Lydia Zhang
TechNet Community Support -
MSSQL Stored Procedure has duplicate OUT parameter
Hi All;
I am using the WLS MSSQL jdbc driver (mssqlserver4v70rel510sp8) for wls
5.1 sp 12. The following code generates a duplicate OUT parameter.
Parameters 4 and 5 are duplicated. I went over the stored procedure in
ISQL, and the problem is not occurring there. Has anyone seen this sort of
problem? I noticed this problem does not occur when I have the "?=" in
front.
stmt = con.prepareCall("{ ?= call webactivate..ValidatePromoCode(?, ?,
stmt.registerOutParameter(1, java.sql.Types.INTEGER);
stmt.setString(2, marketingCode);
stmt.setString(3, activationData.getRawServiceNumber());
stmt.registerOutParameter(4, java.sql.Types.VARCHAR);
stmt.registerOutParameter(5, java.sql.Types.INTEGER);
stmt.registerOutParameter(6, java.sql.Types.INTEGER);
stmt.execute();
Log.putDebug("#1="+stmt.getString(1));
Log.putDebug("#4="+stmt.getString(4));
Log.putDebug("#5="+stmt.getString(5));
Log.putDebug("#6="+stmt.getString(6));
Paul RoweThanks Joseph. I was hoping you would get back to me on this. You are the
king of this newsgroup. Here's what I got, which indicates some type of
problem on my end:
Update count = 1
Update count = 1
Update count = 1
Update count = 1
Update count = 1
Output status: 4
Output param 1: 4
Output param 2: marketingCode activationData.getRawServiceNumber()
Output param 3: 2
"Joseph Weinstein" <[email protected]> wrote in message
news:[email protected]...
Paul Rowe wrote:
Hi All;
I am using the WLS MSSQL jdbc driver (mssqlserver4v70rel510sp8) for
wls
5.1 sp 12. The following code generates a duplicate OUT parameter.
Parameters 4 and 5 are duplicated. I went over the stored procedure in
ISQL, and the problem is not occurring there. Has anyone seen this sortof
problem? I noticed this problem does not occur when I have the "?=" in
front.Hi Paul. Please run this sample program below with the driver you have,and
let me know the output. it works with the latest driver I have. I get:
C:\joe\70bugs>java foo
Update count = 1
Output status: 4
Output param 1: marketingCode activationData.getRawServiceNumber()
Output param 2: 2
Output param 3: 3
The code:
import java.sql.*;
import java.util.*;
class foo {
public static void main(String[] args) throws Exception
Properties props = new Properties();
props.put("user", "sa");
props.put("password", "");
props.put("server", "natoma");
try {
Driver myDriver = (Driver)
Class.forName("weblogic.jdbc.mssqlserver4.Driver").newInstance();
Connection con = myDriver.connect("jdbc:weblogic:mssqlserver4",props);
>
String proc = "create proc foojoe @bar varchar(60), @qwevarchar(60), "
+ " @asd varchar(60) output, @zxc int output, @ert intoutput "
+ " as select @asd = @bar + @qwe select @zxc = 2 select@ert = 3 "
+ " return 4";
Statement s = con.createStatement();
try { s.executeUpdate("drop proc foojoe"); } catch (Exceptionignore){}
s.executeUpdate(proc);
CallableStatement stmt = con.prepareCall("{ ?= callfoojoe(?,?,?,?,?) }");
stmt.registerOutParameter(1, java.sql.Types.INTEGER);
stmt.setString(2, "marketingCode");
stmt.setString(3, " activationData.getRawServiceNumber()");
stmt.registerOutParameter(4, java.sql.Types.VARCHAR);
stmt.registerOutParameter(5, java.sql.Types.INTEGER);
stmt.registerOutParameter(6, java.sql.Types.INTEGER);
stmt.execute();
while (true) // how to handle any callable statement...
ResultSet rs = stmt.getResultSet();
int updateCount = stmt.getUpdateCount();
// If there are no more results or counts, we're done.
if (rs == null && updateCount == -1)
break;
// Check to see if there is a ResultSet
if (rs != null) {
while (rs.next()) {
System.out.println("Get first resultset col by id:" +rs.getString(1));
rs.close();
} // Otherwise, there will be an update count
else {
System.out.println("Update count = " + updateCount);
stmt.getMoreResults();
// Best to retrieve status and output parameters
// after all result sets and update counts have been retrieved.
System.out.println( "Output status: " + stmt.getInt(1));
System.out.println( "Output param 1: " + stmt.getString(4));
System.out.println( "Output param 2: " + stmt.getString(5));
System.out.println( "Output param 3: " + stmt.getString(6));
catch(Exception e) { e.printStackTrace(); } -
How to get all parameter names along with their values in stored procedure which is being executed
Im using sql server 2012, is there any possible way to get all the parameters of a stored procedure along with the values passed to it.
I need these things to build a xml. I mean this should happen in the procedure which being executed and it should be common for all the procedures.
For example, let us suppose we have to procedures,
uspSave, @name='test' @age=20
uspDelete @id=2
now in uspSave procedure, i need to get @name, @age and the values 'test', 20 and in uspDelete, i should get @id with value 2.
For getting the column names, i tried this,
select parameter_name from information_schema.PARAMETERS where specific_name=OBJECT_NAME(@@procid)
now is it possible to loop through the result of above query and can we get the values.I think you need running SQL Server Profiler to capture this info even in SQL Server 2012.
Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
Blog : MS SQL Development and Optimization
Blog : Large
scale of database and cleansing -
Line 390 Under the (Insert into SALES_TRADEIN Table)
I need to insert (TradeIn_1_VIN) Values If there is no values in (TradeIn_1_VIN) then i have to insert (TradeIn_2_VIN) values to the (SALES_TRADEIN) Table.
After i run then below script only (TradeIn_2_VIN) values are get inserted in the table. (TradeIn_1_VIN) are not getting loaded in to the table.
I think there is the problem from Line No (404 to 414) Please help me change those particular lines to insert (TradeIn_1_VIN) Values also.If there is no details then (TradeIn_2_VIN) need to be inserted.
-- =============================================
-- Stored Procedure for Flatfile_Sales
-- =============================================
USE [IconicMarketing]
---==========Sales_Cursor
--USE [IconicMarketing]
--GO
DECLARE
@FileType
varchar(50),
@ACDealerID
varchar(50),
@ClientDealerID
varchar(50),
@DMSType
varchar(50),
@DealNumber
varchar(50),
@CustomerNumber
varchar(50),
@CustomerName
varchar(50),
@CustomerFirstName
varchar(50),
@CustomerLastName
varchar(50),
@CustomerAddress
varchar(50),
@CustomerCity
varchar(50),
@CustomerState
varchar(50),
@CustomerZip
varchar(50),
@CustomerCounty
varchar(50),
@CustomerHomePhone
varchar(50),
@CustomerWorkPhone
varchar(50),
@CustomerCellPhone
varchar(50),
@CustomerPagerPhone
varchar(50),
@CustomerEmail
varchar(50),
@CustomerBirthDate
varchar(50),
@MailBlock
varchar(50),
@CoBuyerName
varchar(50),
@CoBuyerFirstName
varchar(50),
@CoBuyerLastName
varchar(50),
@CoBuyerAddress
varchar(50),
@CoBuyerCity
varchar(50),
@CoBuyerState
varchar(50),
@CoBuyerZip
varchar(50),
@CoBuyerCounty
varchar(50),
@CoBuyerHomePhone
varchar(50),
@CoBuyerWorkPhone
varchar(50),
@CoBuyerBirthDate
varchar(50),
@Salesman_1_Number
varchar(50),
@Salesman_1_Name
varchar(50),
@Salesman_2_Number
varchar(50),
@Salesman_2_Name
varchar(50),
@ClosingManagerName
varchar(50),
@ClosingManagerNumber
varchar(50),
@F_AND_I_ManagerNumber
varchar(50),
@F_AND_I_ManagerName
varchar(50),
@SalesManagerNumber
varchar(50),
@SalesManagerName
varchar(50),
@EntryDate
varchar(50),
@DealBookDate
varchar(50),
@VehicleYear
varchar(50),
@VehicleMake
varchar(50),
@VehicleModel
varchar(50),
@VehicleStockNumber
varchar(50),
@VehicleVIN
varchar(50),
@VehicleExteriorColor
varchar(50),
@VehicleInteriorColor
varchar(50),
@VehicleMileage
varchar(50),
@VehicleType
varchar(50),
@InServiceDate
varchar(50),
@HoldBackAmount
varchar(50),
@DealType
varchar(50),
@SaleType
varchar(50),
@BankCode
varchar(50),
@BankName
varchar(50),
@SalesmanCommission
varchar(50),
@GrossProfitSale
varchar(50),
@FinanceReserve
varchar(50),
@CreditLifePremium
varchar(50),
@CreditLifeCommision
varchar(50),
@TotalInsuranceReserve
varchar(50),
@BalloonAmount
varchar(50),
@CashPrice
varchar(50),
@AmountFinanced
varchar(50),
@TotalOfPayments
varchar(50),
@MSRP varchar(50),
@DownPayment
varchar(50),
@SecurityDesposit
varchar(50),
@Rebate
varchar(50),
@Term varchar(50),
@RetailPayment
varchar(50),
@PaymentType
varchar(50),
@RetailFirstPayDate
varchar(50),
@LeaseFirstPayDate
varchar(50),
@DayToFirstPayment
varchar(50),
@LeaseAnnualMiles
varchar(50),
@MileageRate
varchar(50),
@APRRate
varchar(50),
@ResidualAmount
varchar(50),
@LicenseFee
varchar(50),
@RegistrationFee
varchar(50),
@TotalTax
varchar(50),
@ExtendedWarrantyName
varchar(50),
@ExtendedWarrantyTerm
varchar(50),
@ExtendedWarrantyLimitMiles
varchar(50),
@ExtendedWarrantyDollar
varchar(50),
@ExtendedWarrantyProfit
varchar(50),
@FrontGross
varchar(50),
@BackGross
varchar(50),
@TradeIn_1_VIN
varchar(50),
@TradeIn_2_VIN
varchar(50),
@TradeIn_1_Make
varchar(50),
@TradeIn_2_Make
varchar(50),
@TradeIn_1_Model
varchar(50),
@TradeIn_2_Model
varchar(50),
@TradeIn_1_ExteriorColor
varchar(50),
@TradeIn_2_ExteriorColor
varchar(50),
@TradeIn_1_Year
varchar(50),
@TradeIn_2_Year
varchar(50),
@TradeIn_1_Mileage
varchar(50),
@TradeIn_2_Mileage
varchar(50),
@TradeIn_1_Gross
varchar(50),
@TradeIn_2_Gross
varchar(50),
@TradeIn_1_Payoff
varchar(50),
@TradeIn_2_Payoff
varchar(50),
@TradeIn_1_ACV
varchar(50),
@TradeIn_2_ACV
varchar(50),
@Fee_1_Name
varchar(50),
@Fee_1_Fee
varchar(50),
@Fee_1_Commission
varchar(50),
@Fee_2_Name
varchar(50),
@Fee_2_Fee
varchar(50),
@Fee_2_Commission
varchar(50),
@Fee_3_Name
varchar(50),
@Fee_3_Fee
varchar(50),
@Fee_3_Commission
varchar(50),
@Fee_4_Name
varchar(50),
@Fee_4_Fee
varchar(50),
@Fee_4_Commission
varchar(50),
@Fee_5_Name
varchar(50),
@Fee_5_Fee
varchar(50),
@Fee_5_Commission
varchar(50),
@Fee_6_Name
varchar(50),
@Fee_6_Fee
varchar(50),
@Fee_6_Commission
varchar(50),
@Fee_7_Name
varchar(50),
@Fee_7_Fee
varchar(50),
@Fee_7_Commission
varchar(50),
@Fee_8_Name
varchar(50),
@Fee_8_Fee
varchar(50),
@Fee_8_Commission
varchar(50),
@Fee_9_Name
varchar(50),
@Fee_9_Fee
varchar(50),
@Fee_9_Commission
varchar(50),
@Fee_10_Name
varchar(50),
@Fee_10_Fee
varchar(50),
@Fee_10_Commission
varchar(50),
@ContractDate
varchar(50),
@InsuranceName
varchar(50),
@InsuranceAgentName
varchar(50),
@InsuranceAddress
varchar(50),
@InsuranceCity
varchar(50),
@InsuranceState
varchar(50),
@InsuranceZip
varchar(50),
@InsurancePhone
varchar(50),
@InsurancePolicyNumber
varchar(50),
@InsuranceEffectiveDate
varchar(50),
@InsuranceExpirationDate
varchar(50),
@InsuranceCompensationDeduction
varchar(50),
@TradeIn_1_InteriorColor
varchar(50),
@TradeIn_2_InteriorColor
varchar(50),
@PhoneBlock
varchar(50),
@LicensePlateNumber
varchar(50),
@Cost varchar(50),
@InvoiceAmount
varchar(50),
@FinanceCharge
varchar(50),
@TotalPickupPayment
varchar(50),
@TotalAccessories
varchar(50),
@TotalDriveOffAmount
varchar(50),
@EmailBlock
varchar(50),
@ModelDescriptionOfCarSold
varchar(50),
@VehicleClassification
varchar(50),
@ModelNumberOfCarSold
varchar(50),
@GAPPremium
varchar(50),
@LastInstallmentDate
varchar(50),
@CashDeposit
varchar(50),
@AHPremium
varchar(50),
@LeaseRate
varchar(50),
@DealerSelect
varchar(50),
@LeasePayment
varchar(50),
@LeaseNetCapCost
varchar(50),
@LeaseTotalCapReduction
varchar(50),
@DealStatus
varchar(50),
@CustomerSuffix
varchar(50),
@CustomerSalutation
varchar(50),
@CustomerAddress2
varchar(50),
@CustomerMiddleName
varchar(50),
@GlobalOptOut
varchar(50),
@LeaseTerm
varchar(50),
@ExtendedWarrantyFlag
varchar(50),
@Salesman_3_Number
varchar(50),
@Salesman_3_Name
varchar(50),
@Salesman_4_Number
varchar(50),
@Salesman_4_Name
varchar(50),
@Salesman_5_Number
varchar(50),
@Salesman_5_Name
varchar(50),
@Salesman_6_Number
varchar(50),
@Salesman_6_Name
varchar(50),
@APRRate2
varchar(50),
@APRRate3
varchar(50),
@APRRate4
varchar(50),
@Term2
varchar(50),
@SecurityDeposit2
varchar(50),
@DownPayment2
varchar(50),
@TotalOfPayments2
varchar(50),
@BasePayment
varchar(50),
@JournalSaleAmount
varchar(50),
@IndividualBusinessFlag
varchar(50),
@InventoryDate
varchar(50),
@StatusDate
varchar(50),
@ListPrice
varchar(50),
@NetTradeAmount
varchar(50),
@TrimLevel
varchar(50),
@SubTrimLevel
varchar(50),
@BodyDescription
varchar(50),
@BodyDoorCount
varchar(50),
@TransmissionDesc
varchar(50),
@EngineDesc
varchar(50),
@TypeCode
varchar(50),
@SLCT2
varchar(50),
@DealDateOffset
varchar(50),
@AccountingDate
varchar(50),
@CoBuyerCustNum
varchar(50),
@CoBuyerCell
varchar(50),
@CoBuyerEmail
varchar(50),
@CoBuyerSalutation
varchar(50),
@CoBuyerPhoneBlock
varchar(50),
@CoBuyerMailBlock
varchar(50),
@CoBuyerEmailBlock
varchar(50),
@RealBookDate
varchar(50),
@CoBuyerMiddleName
varchar(50),
@CoBuyerCountry
varchar(50),
@CoBuyerAddress2
varchar(50),
@CoBuyerOptOut
varchar(50),
@CoBuyerOccupation
varchar(50),
@CoBuyerEmployer
varchar(50),
@Country
varchar(50),
@Occupation
varchar(50),
@Employer
varchar(50),
@Salesman2Commission
varchar(50),
@BankAddress
varchar(50),
@BankCity
varchar(50),
@BankState
varchar(50),
@BankZip
varchar(50),
@LeaseEstimatedMiles
varchar(50),
@AFTReserve
varchar(50),
@CreditLifePrem
varchar(50),
@CreditLifeRes
varchar(50),
@AHRes
varchar(50),
@Language
varchar(50),
@BuyRate
varchar(50),
@DMVAmount
varchar(50),
@Weight
varchar(50),
@StateDMVTotFee
varchar(50),
@ROSNumber
varchar(50),
@Incentives
varchar(50),
@CASS_STD_LINE1
varchar(50),
@CASS_STD_LINE2
varchar(50),
@CASS_STD_CITY
varchar(50),
@CASS_STD_STATE
varchar(50),
@CASS_STD_ZIP
varchar(50),
@CASS_STD_ZIP4
varchar(50),
@CASS_STD_DPBC
varchar(50),
@CASS_STD_CHKDGT
varchar(50),
@CASS_STD_CART
varchar(50),
@CASS_STD_LOT
varchar(50),
@CASS_STD_LOTORD
varchar(50),
@CASS_STD_URB
varchar(50),
@CASS_STD_FIPS
varchar(50),
@CASS_STD_EWS
varchar(50),
@CASS_STD_LACS
varchar(50),
@CASS_STD_ZIPMOV
varchar(50),
@CASS_STD_Z4LOM
varchar(50),
@CASS_STD_NDIAPT
varchar(50),
@CASS_STD_NDIRR
varchar(50),
@CASS_STD_LACSRT
varchar(50),
@CASS_STD_ERROR_CD
varchar(50),
@NCOA_AC_ID
varchar(50),
@NCOA_COA_ADDSRC
varchar(50),
@NCOA_COA_MATCH
varchar(50),
@NCOA_COA_MOVTYP
varchar(50),
@NCOA_COA_DATE
varchar(50),
@NCOA_COA_DELCD
varchar(50),
@NCOA_COA_RTYPE
varchar(50),
@NCOA_COA_RTNCD
varchar(50),
@NCOA_COA_LINE1
varchar(50),
@NCOA_COA_LINE2
varchar(50),
@NCOA_COA_CITY
varchar(50),
@NCOA_COA_STATE
varchar(50),
@NCOA_COA_ZIP
varchar(50),
@NCOA_COA_ZIP4
varchar(50),
@NCOA_COA_DPBC
varchar(50),
@NCOA_COA_CHKDGT
varchar(50),
@NCOA_COA_CART
varchar(50),
@NCOA_COA_LOT
varchar(50),
@NCOA_COA_LOTORD
varchar(50),
@NCOA_COA_URB
varchar(50),
@NCOA_COA_Z4LOM
varchar(50),
@NCOA_COA_ACTION
varchar(50),
@NCOA_COA_QNAME
varchar(50),
@NCOA_DPV_AA
varchar(50),
@NCOA_DPV_A1
varchar(50),
@NCOA_DPV_BB
varchar(50),
@NCOA_DPV_CC
varchar(50),
@NCOA_DPV_M1
varchar(50),
@NCOA_DPV_M3
varchar(50),
@NCOA_DPV_N1
varchar(50),
@NCOA_DPV_P1
varchar(50),
@NCOA_DPV_P3
varchar(50),
@NCOA_DPV_RR
varchar(50),
@NCOA_DPV_R1
varchar(50),
@NCOA_DPV_STATUS
varchar(50),
@NCOA_DPV_F1
varchar(50),
@NCOA_DPV_G1
varchar(50),
@NCOA_DPV_U1
varchar(50),
@myerror
varchar(500),
@SalesID
int,
@errornumber int,
@errorseverity varchar(500),
@errorstate int,
@errorprocedure varchar(500),
@errorline varchar(50),
@errormessage varchar(1000);
DECLARE Sales_Cursor CURSOR FOR
SELECT * from FLATFILE_SALES;
OPEN Sales_Cursor;
:r C:\Clients\BlackBook\BlackBookMarketing\Bharath\LOG_SALES_INSERT.sql
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @VehicleVIN ;
--===============================================================================
-- ****************** insert into Sales Table ***********
BEGIN TRY
INSERT INTO Sales
IconicDealerID,
DealNumber,
CustomerNumber,
DMSType,
ContractDate
VALUES (@ClientDealerID,@DealNumber,@CustomerNumber,@DMSType,@ContractDate);
END TRY
BEGIN CATCH
SELECT
@errornumber = ERROR_NUMBER()
,@errorseverity = ERROR_SEVERITY()
,@errorstate = ERROR_STATE()
,@errorprocedure = ERROR_PROCEDURE()
,@errorline = ERROR_LINE()
,@errormessage = ERROR_MESSAGE();
:r C:\Clients\BlackBook\BlackBookMarketing\Bharath\LOG_SALES_INSERT.sql
@errornumber ,
@errorseverity ,
@errorstate,
@errorprocedure,
@errorline,
@errormessage);
END CATCH
PRINT @errornumber;
PRINT @errorseverity;
PRINT @errorprocedure;
PRINT @errorline;
PRINT @errormessage;
PRINT @errorstate;
set @myerror = @@ERROR;
-- This PRINT statement prints 'Error = 0' because
-- @@ERROR is reset in the IF statement above.
PRINT N'Error = ' + @myerror;
set @SalesID = scope_identity();
PRINT @SalesID;
--================================================================================
--Insert into SALES_TRADEIN Table
BEGIN TRY
INSERT INTO SALES_TRADEIN
SalesID,
TradeIn_VIN,
TradeIn_Make,
TradeIn_Model,
TradeIn_ExteriorColor,
TradeIn_Year,
TradeIn_Mileage,
TradeIn_Gross,
TradeIn_Payoff,
TradeIn_ACV,
TradeIn_InteriorColor
VALUES
@SalesID,
case when @TradeIn_1_VIN is not null then @TradeIn_2_VIN end,
case when @TradeIn_1_Make is not null then @TradeIn_2_Make end,
case when @TradeIn_1_Model is not null then @TradeIn_2_Model end,
case when @TradeIn_1_ExteriorColor is not null then @TradeIn_2_ExteriorColor end,
case when @TradeIn_1_Year is not null then @TradeIn_2_Year end,
case when @TradeIn_1_Mileage is not null then @TradeIn_2_Mileage end,
case when @TradeIn_1_Gross is not null then @TradeIn_2_Gross end,
case when @TradeIn_1_Payoff is not null then @TradeIn_2_Payoff end,
case when @TradeIn_1_ACV is not null then @TradeIn_2_ACV end,
case when @TradeIn_1_InteriorColor is not null then @TradeIn_2_InteriorColor end
END TRY
BEGIN CATCH
SELECT
@errornumber = ERROR_NUMBER()
,@errorseverity = ERROR_SEVERITY()
,@errorstate = ERROR_STATE()
,@errorprocedure = ERROR_PROCEDURE()
,@errorline = ERROR_LINE()
,@errormessage = ERROR_MESSAGE();
:r C:\Clients\BlackBook\BlackBookMarketing\Bharath\LOG_SALES_INSERT.sql
END CATCHThis is what I've understood from your question. You want to replace @TradeIn_2_VIN value if @TradeIn_1_VIN
is NULL, else the value of @TradeIn_1_VIN.
If this is the requirement then, your CASE statement is missing ELSE part. You can re-write this as below
case when @TradeIn_1_VIN is null then @TradeIn_2_VIN
ELSE @TradeIn_1_VIN end,
or simply you can replace the CASE statement with the below
COALESCE function,
COALESCE(@TradeIn_1_VIN, @TradeIn_2_VIN),
Krishnakumar S -
JDBC Sender MSSQL Stored Procedure - Multiple Select Statements
Hello all,
I will proceed to tell you my problem, for which solution I request your kind advice:
Im working in a project for a retailer, which consists in sending the information from erp and sql server to pos thru XI interfaces.
One of the interfaces is about sending items from sql server to a file so the pos can load it into the system. For doing so I have devloped an stored procedure which function is to return several select statements as many stores the retailer might have, so they can have a different file per store along with its corresponding items in it.
The thing is that XI just gets the first select statement and creates the corresponding file, but it seems to ignore the remaining responses as I'm neither getting any file nor an error afterwards.
So, my question is: is XI capable of handling multiple select responses from an Stored Procedure in graphical mapping??? Or am I just wasting my time trying?
Thanks in advice for your help.
Regards.Hello Ramkumar,
After 5 days trying, I finally made it work out applying your advice. Below the short explanation of what I did:
My Source structure is: Main Node->Row->Records (Material Number, StoreNum, Price, Status)
My Target structure is: Main Node->File Node->Record Node->Records ( Material Number, Price, Status)
The key was to make all the occurrences happen against StoreNum node. So, based on what you adviced these two where the key mappings:
1) The Mapping that will create a new file for each different store that comes in the query (In my case, query was already sort by store using an sql "order by" function, if not you can also use xi node function "sort" as Ramkumar suggested)
StoreNum->RemoveContext->SplitbyValue (Value Changed)->Collapse Contexts->File Node
2) The Mapping that will create each record in its corresponding store file:
StoreNum->RemoveContext->SplitbyValue (Value Changed)->Record Node
And Voilá !!! It worked.
Thanks very much Ramkumar.
Regards.
Maybe you are looking for
-
Problems when trying to export VI using save hierarchy
I have a VI I want to send to another engineer at a different location. I know what version of LabVIEW they have, but I do not know if they have all the instrument drivers. I choose 'save hierarchy' to duplicate the VI and all it's dependencies to a
-
Burning a DVD from Final Cut Pro?
Can anyone tell me how to import a Final cut movie into iDVD so I can burn a DVD. When I try it say's the files not compatible. I have to have this done by Wednesday, so I would greatly appreciate it. Thanks
-
How do you create a PRINTABLE wallpaper pattern?
This may sound really stupid but I have searched the internet thoroughly and can not find an answer to this. I am fluent in Photoshop and semi fluent in Illustrator. I run CS6 for both. No what I want to be able to do is create a repeating pattern th
-
Help: Tab content "locked" in IE but not in Firefox
I'm in the process of rebuilding a product page to be fully integrated with Spry. I have a tab labeled "buy" that contains a form. I can't click on the buttons in IE. In firefox it works fine. link: http://www.hotpuppy.com/product_zoom.asp?productnum
-
Extracting data to an external system
Hi, We need to extract data from an R/3 system into a BW system and the same data (and more) should also be uploaded into a customer application (based on Oracle). I wonder what's the best in order to load data into this external system: 1. Read data