Column Name with Dynamic SQL
I use DynamicStagingArea for retrieval of a dynamic table.
I there any possibility to get the column names for the
...how to dynamic get the columns list from any sql?
when we use "select * from sometab;" in database administration, PB will
show us all the columns in the "sometab" with data. I just wonder how PB can
get the columns list? if we can write a same program to do so? Dynamic
Cusor? No, its only get the column data. Or, it is just a function provided
by the Database environment? if then, with oracle, how can we get the
columns list when whatever SQL statement given?
Every RDBMS I have seen keeps the table definitions in tables. For Oracle,
the view SYS.ALL_TAB_COLUMNS should have what you need, and SELECT is
usually...Dynamic column names in T-SQL?
Does anyone know of a clever hack that can be used to generate column names
on the fly, either from local variables or values in a temp table?
Robert Gumpertz wrote:
> Does anyone know of a clever hack that can be used to generate column names
> on the fly, either from local variables or values in a temp table?
For what purpose? I'm not following where you're going with this?
(maybe I need some caffeine?)
Mark A. Parsons
Iron Horse, Inc.
This is a reporting application where the user can submit a random list of
states; the result is a count by categ...dynamic sql with variable column name
I want to give select list(columan names) as variable to the dynamic sql
is this possible ?
sql statement that I wrote below :
Sqlstatement = 'SELECT ? FROM TABLE_NAME
WHERE TABLE_NAME.COLUMN1 ="'+variable1+'" and &
TABLE_NAME.COLUMN2 = "'+variable2+'" and &
TABLE_NAME.COLUMN3 = "'+variable3+'" and &
TABLE_NAME.COLUMN3 = "'+variable3+'"'
PREPARE SQLSA FROM :Sqlstatement ;
DESCRIBE ...generating month column with dynamic sql
Can someone help me generate the month column by using dynamic sql with this query:
Right now I only have Sept and Oct 08 in the database I hope this makes sense.
SUM(CASE WHEN MONTH(DowrDt)=9 AND YEAR(DowrDt)=2008 THEN PctInt Else 0 END) AS [Sep 08],
SUM(CASE WHEN MONTH(DowrDt)=10 AND YEAR(DowrDt)=2008 THEN PctInt Else 0 END) AS [Oct 08],
SUM(CASE WHEN MONTH(DowrDt)=11 AND YEAR(DowrDt)=2008 THEN PctInt Else 0 END) AS [Nov 08],
SUM(CASE WHEN MONTH(DowrDt)=12 AND YEAR(DowrDt)=2008 THEN PctInt Else 0 END) AS [Dec 08],
SUM(CASE WHEN MONTH(DowrDt)=1 AND YEAR(DowrDt)...SQL Injection and Dynamic SQL
The consensus on avoiding SQL injection attacks is to pass all your collected data to a stored procedure. If you have to return a result set from a complex form, the answer seems to be to use dynamic SQL. On further study, I discovered that dynamic SQL has a lot of potential pitfalls and low and behold can still be vulnerable to injection attacks. I know that I am not the first person to ever try and collect data from a web form and return a result set, so what are the best practices? Say I have a complex form with about 25 search criteria (most of which are optional), I go through all t...How to create dynamic columns in the Datawindow Using powerbuilder
Can any one let me know How to create dynamic columns in the data window
using modified method.
Thanks in Advance
Please refer "Datawindow Syntax" tool provided by sybase for
generating the syntax to create dynamic columns.
/*************Dynamic column Syntax
<DW Control Name>.Modify(&
"create column( id=<an integer> tabsequence=<an integer>
accelerator='<a single letter>' moveable=<0 - False, 1 -
True> resizeable=<0 - False, 1 - True> pointer='<Arrow!,
Cross!, HourGlass!, IBeam!, Icon!,...Dynamic Datagrid
Can anyone help with this issue :
I have created an editable dynamic grid with templates and need to update the columns(ie add more or remove columns) in the grid if certain data changes. I have created the datagrid in Sub page_init, but need to add columns when necessary. I think I basically need to know how to call the onInit event from my page when needed to recreated the grid. The onInit should read the data from the dbase and if the are any changes, it will be reflected on the new grid.
You can always call an implementation of the Init event of the page from...Dynamic SQL in Transact SQL
Does Dynamic SQL can be done in transact sql format in stored procedure?
any reference can be read?
...Dynamically setting the column name on a SQL query
Can anyone show me or tell if the following is possible.
I have a SQL query as shown below:
SQL = "SELECT revenue_forecast.oct AS 'revenue' ...........
What I need to do is dynamically set the column in this SQL query. So i need to be able to place a variable in the part after the revenue_forecast "." .
Can someone show me how to do this?
It depends on your data source, but most data sources do not allow you to parameterize column names. You have a couple of choices. One is to concatenate the name into the string as in...
SQL = "SELECT reven...dynamically adding columns to datagrid from sql statement
hi,i have seen some of the datagrid samples in internet. In most of the cases the datagrid is bind to some table. But if i want to display the output of an sql query(contains select statement with n number of columns) in Datagrid, i can simply use AutogenerateColumns=true and populate the datagrid without having any bound columns. That is fine.If i want to add some more extra columns like a checkbox column and an edit link button column i can do it using property builder. But,the problem is how can i order the columns in datagrid.for example: 1st col: checkboxes &n...Problem with PowerBuilder, Dynamic SQL, Oracle and CLOB
(PB 8.0.3 build 9704 & Oracle9i)
I'm trying to create a "generic" response window to manipulate CLOBs from
various tables (one at a time).
I pass in three variables to the window:
So far I'm not even able to retrieve the CLOB value using Dynamic SQL.
I try the following:
I set up a string in the PB Code:
ls_get_string = " SELECTBLOB " + is_field_name + " FROM " + is_table_name +
This statement returns one row (I took the ls_get_string value and executed
the statement in...Dynamic SQL in a PowerBuilder 10.0 program
I have a PowerBuilder 10.0 program that has the following
embedded SQL update statement in it:
UPDATE timsheet SET status = 'S' WHERE timsheet.timkpr =
:g_timkpr AND timsheet.tmdate >= :Start_dte AND
timsheet.tmdate <= :End_dte AND timsheet.clid +
timsheet.clsb + timsheet.mtid + timsheet.mtsb <>
:g_holdmatter AND timsheet.status = ' ' ;
I need to change this so that the UPDATE statement can be
built at runtime based upon some information entered on a
window by the user. Specifically the WHERE clause will
involve different fields and dif...