Regarding Query Generator One Column Extra
hi.
i have one requirement
ie.
normally
sleect ordr.cardcode from ordr
i put this query in query generator
so, the result will come like
s
y
x
p
but what i need is, i want one column extra each time the value of this column is 'co'
like
co s
co y
co x
co p
is it possible...
i need your valuable suggestions..
Hi Srinivas,
Fine Srini..hope you are fine..
If you got the answer please close this thread with tag correct answer...
Regards
Ajith
Similar Messages
-
Oracle DB Query Generating Invalid Column Index error
Dear All,
Apologies for a question on this rather basic error but I don't understand why i'm experiencing the behaviour described.
The piece of code below connects to a database, runs a query, then attempts to display the contents of the resultset. I understand from other posts on the topic that the query I am executing (INSERT INTO table VALUES (...)) as in the comments below needs to have autocommit disabled to allow me to access the resultset without the transaction closing.
public void runQuery(String query) throws Exception { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection(database, username, password); con.setAutoCommit(false); Statement st = con.createStatement(); ResultSet rs = st.executeQuery (query); // "select * from user_tables" // "INSERT INTO BH VALUES ('','2.25','Dark Red','Samsonite','4987638762')" while (rs.next()) { System.out.print (rs.getString(1)); // Exception thrown here } con.commit(); st.close(); con.close(); }
I have removed try {} catch {} error handling for clarity.
I am receiving the invalid column index error from the indicated line, which clearly suggest column 1 doesn't exist, however if i run the same query in another tool, something like the following is returned:
Rows Affected
1
The query is being received by the database as the row ends up in the table intact, so I am clearly missing something about how to access the resultset correctly.
I am guessing that I am either misusing/misunderstanding the autocommit option or that the resultset is different to what I am expecting...
Can someone please shed a little light?
Many thanks!
GeorgeOk, I've done a little more digging, and i've come to the conclusion that an INSERT query doesn't return a resultset (or returns an empty one)
Could someone with a little more knowledge confirm this as I've had little luck finding an explicit yes or no from the web!
Many Thanks in advance... -
Regarding query generator like operator...
hi.
i need a small information.
i want to run below query in query geneator..
but it's not working may i know how can i run..
select ojdt.TransId from ojdt where ojdt.Memo like '%Process Salary DocNo%'Hi
select ojdt.TransId from ojdt where ojdt.Memo like '%[0]%' This query return all data where Memo field on journal entry contain 0 (Zero).
If your Memo field on Journal entry contain value like "process salary docno-5" ,then your query
select ojdt.TransId from ojdt where ojdt.Memo like '%Process Salary DocNo%' will definately return data.
Thanks -
Qyery problem in query generator
Hi friends,
I have one problem regarding query generator.
I want to take the field value from the active form for query generator. I got in the demo that u have to use $[table.field]. But still I got the error.
Query which I tried.
SELECT 'TRUE' FROM OCRD T0 WHERE $[OCRD.CardCode] = '[%0]'
any one who take the value from active form as a parameter and pass to the query in the query generator please send my the sample query.
Thanks in advance.hi,
Thanks for your reply.
When I try to execute the first query from the query generator I got the error.
Error :-
Incorrect syntax near $4.0.0
statement 'Received Alerts' could not be prepared.
When I try to execute the second query from the query generator I got the error.
Error :-
Incorrect syntax near 'Ocrd.cardcode'
Statement 'Search function (CSHS)' could not bne prepared.
What would be the reason.
Please help me in solving this problem. -
Update one column in Query only block
Hi,
I have a question regarding multi-record, multi-columns form block.
A block has 100 columns (column1 to column100).
We have two separate version of same form. In query only mode, update_allowed property of all the blocks in the form is False.
But in query only form, one specifc column should be updateable.
How can use Custom.pll to achive this functionality ?
I tried following steps
1. In when-new-item instance of column 54, wrote set_item_property and set_block_property
2. Update allowed for block and specific item is True
I know that Block property will override the property of items.
Now all the items are updateable in query only form. But i want only one column updateable.
Appreciate you valuable input on this.
ThanksThis is an eBusiness-related question, you should post it in the eBusiness-forum. From the "pure" forms point of view, set the Block as updateable and set all item except the one you want to be updateable to UPDATE_ALLOWED =PROPERTY_FALSE
-
Update multiple UDF from one query generator
Hi All,
I have Form1 with multiple UDF1 which have been key in by users
And another Form2 with multiple UDF2 which exactly same with Form1 UDF1
Is there a way that I can copy multiple UDF at Form2UDF2 from Form1UDF1 instead of creating query for each individual UDF, where in query generator I can select more the one column but only first column will be insert to the single UDF.
ThanksHi Firos,
I mean I have 7UDF in the Payment Form where the information to this UDF are come from 7UDF in the invoice form which already created previously so I would like to copy those UDF from invoice to UDF in payment by using single query to capture all the UDF information by doing:
SELECT T0.[DocNum], T0.[UDF1], T0.[UDF2], T0.[UDF3], T0.[UDF4], T0.[UDF5], T0.[UDF6], T0.[UDF7]
FROM OINV T0 WHERE T0.[CardCode] = $[ORCT.CardCode]
From above query can I pass the result directly to UDF in Payment Form? or I need to create one query for each individual UDF.
Thanks -
Query to get the data of all the columns in a table except any one column
Can anyone please tell how to write a query to get the data of all the columns in a table except one particular column..
For Example:
Let us consider the EMP table.,
From this table except the column comm all the remaining columns of the table should be listed
For this we can write a query like this..
Select empno, ename, job, mgr, sal, hiredate, deptno from emp;
Just to avoid only one column, I mentioned all the remaining ( 7 ) columns of the table in the query..
As the EMP table consists only 8 columns, it doesn't seem much difficult to mention all the columns in the query,
but if a table have 100 columns in the table, then do we have to mention all the columns in the query..?
Is there any other way of writing the query to get the required result..?
Thanks..Your best best it to just list all the columns. Any other method will just cause more headaches and complicated code.
If you really need to list all the columns for a table because you don't want to type them, just use something like...
SQL> ed
Wrote file afiedt.buf
1 select trim(',' from sys_connect_by_path(column_name,',')) as columns
2 from (select column_name, row_number() over (order by column_id) as column_id
3 from user_tab_cols
4 where column_name not in ('COMM')
5 and table_name = 'EMP'
6 )
7 where connect_by_isleaf = 1
8 connect by column_id = prior column_id + 1
9* start with column_id = 1
SQL> /
COLUMNS
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,DEPTNO
SQL> -
EA2: Code is generated for only one column with Domain check constraint.
I created a Domain with a Value List (Y or N - Yes or No) and used that domain for two columns in the same table. But for only one column (the last one) the check appears in the generated DDL.
After I enabled the "Use Domain Constraints" both checks appear in the DDL, but one as an inline check constraint and one as an "Alter table add contraint.."
Once I changed the naming Template for the check constraint, both constraints are generated as an Alter table clause. The inline check constraint is only generated when the name of the constraint (according to the template) is too long. It would be nice if I could choose if I want an inline or a separate check constraint definition.
Edited by: Roel on Nov 23, 2010 11:55 AM
Edited by: Roel on Nov 23, 2010 12:02 PMI logged ER for that
Philip -
Can i update more then one column using select query.
Dear All,
Can i update more then one column of target table A from source table B. Like
Update table A set A.A1 = (Select B.B1 from B where A.A3 = B.B3).
Above stmt. I am updating only one column. But I want to update more then one column A.A1 and A.A2
Plz give me the possible ways.
Thanks,
VikasYes you can do. Try the below Query
Update A set (A.A1,A.A2) = (Select B.B1,B.B2 from B where A.A3 = B.B3) -
Introduction
In SQL Server Reporting Services, we can define a mapping between the fields that are returned in the query to specific delivery options and to report parameters in a data-driven subscription.
For a report with a parameter (such as YEAR) that allow multiple values, when creating a data-driven subscription, how can we pass a record like below to show correct data (data for year 2012, 2013 and 2014).
EmailAddress Parameter
Comment
[email protected] 2012,2013,2014 NULL
In this article, I will demonstrate how to configure a Data Driven Subscription which get multi-value parameters from one column of a database table
Workaround
Generally, if we pass the “Parameter” column to report directly in the step 5 when creating data-driven subscription.
The value “2012,2013,2014” will be regarded as a single value, Reporting Services will use “2012,2013,2014” to filter data. However, there are no any records that YEAR filed equal to “2012,2013,2014”, and we will get an error when the subscription executed
on the log. (C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles)
Microsoft.ReportingServices.Diagnostics.Utilities.InvalidReportParameterException: Default value or value provided for the report parameter 'Name' is not a valid value.
This means that there is no such a value on parameter’s available value list, this is an invalid parameter value. If we change the parameter records like below.
EmailAddress Parameter Comment
[email protected] 2012 NULL
[email protected] 2013 NULL
[email protected] 2014 NULL
In this case, Reporting Services will generate 3 reports for one data-driven subscription. Each report for only one year which cannot fit the requirement obviously.
Currently, there is no a solution to solve this issue. The workaround for it is that create two report, one is used for view report for end users, another one is used for create data-driven subscription.
On the report that used create data-driven subscription, uncheck “Allow multiple values” option for the parameter, do not specify and available values and default values for this parameter. Then change the Filter
From
Expression:[ParameterName]
Operator :In
Value :[@ParameterName]
To
Expression:[ParameterName]
Operator :In
Value :Split(Parameters!ParameterName.Value,",")
In this case, we can specify a value like "2012,2013,2014" from database to the data-driven subscription.
Applies to
Microsoft SQL Server 2005
Microsoft SQL Server 2008
Microsoft SQL Server 2008 R2
Microsoft SQL Server 2012
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.For every Auftrag, there are multiple Position entries.
Rest of the blocks don't seems to have any relation.
So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
Try out this snippet.
DATA lt_data TYPE TABLE OF string.
DATA lv_data TYPE string.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = 'C:\temp\test.txt'
CHANGING
data_tab = lt_data
EXCEPTIONS
OTHERS = 19.
CHECK sy-subrc EQ 0.
TYPES:
BEGIN OF ty_str,
a1 TYPE string,
a2 TYPE string,
a3 TYPE string,
p1 TYPE string,
p2 TYPE string,
p3 TYPE string,
END OF ty_str.
DATA: lt_str TYPE TABLE OF ty_str,
ls_str TYPE ty_str,
lv_block TYPE string,
lv_flag TYPE boolean.
LOOP AT lt_data INTO lv_data.
CASE lv_data.
WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
lv_block = lv_data.
lv_flag = abap_false.
WHEN OTHERS.
lv_flag = abap_true.
ENDCASE.
CHECK lv_flag EQ abap_true.
CASE lv_block.
WHEN '[Auftrag]'.
SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
WHEN '[Position]'.
SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
APPEND ls_str TO lt_str.
ENDCASE.
ENDLOOP. -
SQL Statement needed for Query Generator
Dear Experts,
My view has the following three columns.
1, Start Date
2. End Date
3. Balance.
I need an SQL statement to write in query generator, which has to check if EndDate is less than the Current date and balance is above zero. If so, it assumes the last date of the job is already over, outstanding materials not yet been returned. Hence it has to return 'Pending'. If EndDate is greater than current date, it means final date for completion of the process is yet to come. So the task is in progress, hence it has to return 'Progress'. If the balance is Zero, all materials connected with the task have been received either as a FG or as Raw Materials. So it has to return, 'Completed'. I need a singe SQL Statement for this.
Please help me.
Thanks in advance.
Regards
AnandDear Anand,
Try this one:
CASE balance WHEN 0 THEN 'Completed' ELSE CASE WHEN DATEDIFF(DD, EndDate, GetDate()) >= 0 THEN 'Progress' ELSE 'Pending' END END
I have assumed you don't have negative balance. It that is not true, give me the complete case.
Thanks,
Gordon
Thanks,
Gordon -
How to Generate Dynamic Columns from SQL
Hi Friends,
I want to create a data fromat like This
Showroom / date 01-01-09 02-01-09 03-01-09 04-01-09 05-01-09 06-01-09 07-01-09
S1 20 10 09 90 90 10 100
S2 10 1 1 2 6 2 10
S3 5 7 9 1 2 3 12This Data is Just like Matriz Reports....................................
Here i Want to Generate Date column value Dynamically.....................is it possible through SQL
the values are Sales value for each showroom for diffrent date value
all sale,showroom and Date Column are in one Table......................
It should Generate date Dynamically depending on User VAlues./..............
Thanks in Advancesomething to play with (not tested as I don't have database access)
declare
/* assuming table showroom_sales has columns a_showroom,a_date,a_sale */
the_sql varchar2(32000) := 'select a_showroom';
day_from date := to_date('20090101','yyyymmdd');
day_till date := to_date('20090107','yyyymmdd');
begin
for d in (select a_date from showroom_sales where a_date between day_from and day_till)
loop
the_sql := the_sql ||
',max(decode(a_date,to_date('''||to_char(d.a_date,'yyyymmdd')||''',''yyyymmdd''),a_sale,null)) "'||to_char(d.a_date,'dd-mm-rr')||'"'
end loop;
the_sql := the_sql || ' from showroom_sales group by a_showroom order by a_showroom ';
dbms_output.put_line(the_sql); /* to verify if query is correct or not */
end;the code above should generate something like (provided all those dates appear in your showroom_sales table)
select a_showroom,
max(decode(a_date,to_date('20090101','yyyymmdd'),a_sale,null)) "01-01-09",
max(decode(a_date,to_date('20090102','yyyymmdd'),a_sale,null)) "02-01-09",
max(decode(a_date,to_date('20090103','yyyymmdd'),a_sale,null)) "03-01-09",
max(decode(a_date,to_date('20090104','yyyymmdd'),a_sale,null)) "04-01-09",
max(decode(a_date,to_date('20090105','yyyymmdd'),a_sale,null)) "05-01-09",
max(decode(a_date,to_date('20090106','yyyymmdd'),a_sale,null)) "06-01-09",
max(decode(a_date,to_date('20090107','yyyymmdd'),a_sale,null)) "07-01-09"
from showroom_sales
group by a_showroom
order by a_showroom to be executed to get the result as required
Regards
Etbin -
Dear all,
I face an issue in Query generator.
When i execute the query in query generator, the error is like this
1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
'Service Contracts' (OCTR)
My query is like this
Declare @StartYear as char(4)
Declare @EndYear as char(4)
Declare @Dept as char(3)
Declare @UnitBusiness as char(3)
Begin
set @StartYear = (Select YEAR(T0.[RefDate]) from JDT1 T0 where T0.[RefDate] = [%0] )
set @EndYear = (Select YEAR(T1.[RefDate]) from JDT1 T1 where T1.[RefDate] = [%1])
set @Dept = (Select T2.[Name] from OASC T2 where T2.[Name] = [%2])
set @UnitBusiness = (Select distinct SUBSTRING(T3.[Segment_0],10,2) from OACT T3 where ( T3.[Segment_0] = [%3] OR ( 1 = (CASE WHEN [%3] = 'All' THEN 1 ELSE 2 END) ) ))
Exec NEC_RPT_FinanceReport @StartYear,@EndYear,@Dept,@UnitBusiness
End
The problem is i can not show the input screen after i execute the query generator.
If i remove the the Variable @Dept and replace with the value it runs well.
Does any one know where is the problem ?
Thanks in advance
Regards
Bodhi86HI Neetu, i have change the query without using store procedure
my query is like this
Declare @StartYear as char(4)
Declare @EndYear as char(4)
Declare @Dept as char(3)
Declare @UnitBusiness as char(3)
Begin
set @StartYear = (Select YEAR(T0.[RefDate]) from JDT1 T0 where T0.[RefDate] = [%0] )
set @EndYear = (Select YEAR(T1.[RefDate]) from JDT1 T1 where T1.[RefDate] = [%1])
set @Dept = (Select T2.[Name] from OASC T2 where T2.[Name] = [%2])
set @UnitBusiness = (Select distinct SUBSTRING(T3.[Segment_0],10,2) from OACT T3 where ( T3.[Segment_0] = [%3] OR ( 1 = (CASE WHEN [%3] = 'All' THEN 1 ELSE 2 END) ) ))
Select @StartYear,@EndYear,@Dept,@UnitBusiness
The error is like this
1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Must specify table to select from.
2). [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement 'User-Defined Values' (CSHS) (s) could not be prepared.
Can you help me
Thanks in advance -
How to merge dates in the same year in one column in rdlc report ?
dears
I need to create like this report but I cannot merge the transactions in the days in one column return to the month as in the table
Delivery Schedule
2010
2011
2012
2013
2014
Model / Month
Total
Total
Total
Total
Jan
Feb
March
April
May
June
July
Aug
Sep
Oct
Nov
Dec
Total
item1
0
item2
11
1
1
2
item3
3
1
1
2
item4
14
1
1
1
1
1
1
1
7
item5
10
2
2
1
1
1
4
10
1
1
1
1
25
item6
0
item7
7
1
1
2
1
1
1
7
item8
19
4
4
5
11
10
4
7
13
2
5
3
68
item9
1
2
1
1
5
item10
15
3
5
5
5
8
5
3
7
5
8
1
3
58
item11
63
15
8
4
12
6
11
8
7
24
11
6
112
item12
3
1
1
1
1
1
2
1
2
10
item13
32
3
7
7
7
8
5
5
10
2
54
item14
16
3
2
5
7
9
8
6
3
2
45
Total Delivery
0
0
0
193
29
29
21
26
51
36
40
40
44
38
25
16
395Hi Eng ,
Based on my understanding, the date field exists in the database, then you want to display the corresponding year and month within the report and perform sum total,right?
In your scenario, since you haven’t provided the sample data, we create the database with some data. Then design the report with the structure you provided. Please refer to our test steps and results:
1. Create the database with the query below:
create table test1
[item] nvarchar(50),
[date] date,
value int)
insert into test1 values
('item1','2014/02/08',10),
('item2','2014/02/22',56),
('item3','2014/07/18',45),
('item3','2014/07/18',40),
('item4','2015/02/26',36),
('item5','2015/02/12',79)
2. Design the report like below:
3. Preview the report.
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
How to transfer ABAP query from one server to another server
Hi all,
I have a ABAP query in development server and i need to transport it to production server.
I have attached a transaction to it using the program which got generated in the back ground
from the abap query in the developemnt server.
I have downloaded and uploaded a ABAP query from one server to another server.
But the program which got generated in the back ground in the production server is different from
program which is generated in the development server.
But my transaction is attached to the program in the development server.If i transport the transaction
to production server,it is giving error since that program is not present in the production server.
Am i going in the right way......?
Is there any problem in my upload/download procedure ?
Is there any way to achieve my purpose ...............?
Please kindly reply me at the earliest.You have different ways to call a query using a t.code. One way is to create a pgm with the following code and attach a t-code to it.
data: gv_test type sy-repid.
DATA: GV_USERGROUP TYPE AQADEF-BGNAME VALUE 'FI',
GV_QUERY TYPE AQADEF-QUNAME VALUE 'ZCON_FI_QUERY',
GV_RNAME TYPE AQADEF-PGNAME .
CALL FUNCTION 'RSAQ_REPORT_NAME'
EXPORTING
WORKSPACE = ''
USERGROUP = GV_USERGROUP
QUERY = GV_QUERY
IMPORTING
REPORTNAME = GV_RNAME
* For the dynamic excution of the called query assisgn GV_RNAME to <gv_test>.
gv_test = GV_RNAME.
SUBMIT (gv_test) via selection-screen and return.
Alternate way is while creating T-Code you choose option Transaction with parameters.
Transaction as START_REPORT and in default values table control at bottom give as follows
D_SREPOVARI-REPORTTYPE = AQ
D_SREPOVARI-REPORT = User group
D_SREPOVARI-EXTDREPORT = Your Query name
Regards
Sathar
Maybe you are looking for
-
I bought my airport express a couple of months ago, it works fine connecting to the internet, but I have never been able to use airTunes. The external speaker menu does not appear in iTunes. I have tried everything that I can think of, and the people
-
Best Practices for Batch Updates, Inserts and Complex Queries
The approach we have taken for our ALDSP Architecture is to model or DASi as Business Data Objects, each DS joining several (some times many) tables and lookups. This works ok when needing to access individual records for read and update, but when we
-
Can I retrieve a deleted video that's not backed up?
I just recorded a 30 minute video then accidentally deleted a minute after recording. I'm at a conference so it was not backed up. Is there any way to retrieve it on my iPhone 5?
-
Hi! I've been having a problem with a screen artifacts on Adobe Illustrator CC. whenever I select an object and try to drag it/scale it up or down, I get grey "squares" just covering my entire screen. The squares disappear when I mouse over them (era
-
The summary page no longer displays the first entry. The picture is overlapping the next entry and the text has disappeared. All entries appear on the archives page and behave properly. How do I get the first entry to appear on the summary page? Can'