Dynamic column from powerscript to SQL ?

Dear all,
I've got table trans_comp with column name 'day1' to 'day31' and batch_no as 
primary key , I do this in powerscript and It works well
ls_colday = '4'
li_tothour = 10
ls_sql = 'update trans_comp set day' + string(ls_colday) + ' = ' + 
string(li_tothour) + " where batch_no = '" +  a_batchno  + "';"
    execute immediate: ls_sql;

The problem is I want to write it down as a trigger in SQLAnywhere10 DB, is 
there any way to do this? How to write this syntax into a sql statement ?
Thanks for all your help 

0
ekologi
1/14/2011 5:33:26 PM
sybase.powerbuilder.general 62418 articles. 11 followers. Follow

1 Replies
891 Views

Similar Articles

[PageSpeed] 44

Try the SQL Anywhere newsgroup or this site: http://sqla.stackexchange.com/

On 1/14/2011 12:33 PM, ekologi wrote:
> Dear all,
> I've got table trans_comp with column name 'day1' to 'day31' and 
> batch_no as primary key , I do this in powerscript and It works well
> ls_colday = '4'
> li_tothour = 10
> ls_sql = 'update trans_comp set day' + string(ls_colday) + ' = ' + 
> string(li_tothour) + " where batch_no = '" +  a_batchno  + "';"
>    execute immediate: ls_sql;
>
> The problem is I want to write it down as a trigger in SQLAnywhere10 
> DB, is there any way to do this? How to write this syntax into a sql 
> statement ?
> Thanks for all your help
0
Roland
1/14/2011 6:38:34 PM
Reply:

Similar Artilces:

Column Name with Dynamic SQL
Hi, I use DynamicStagingArea for retrieval of a dynamic table. I there any possibility to get the column names for the table? Roland Sattler ...

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 statement.. is this possible ? sql statement that I wrote below : string Sqlstatement,sqlst1,Stringvar decimal decvar 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.  SELECT Sort,Reg, 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
Hi, Can any one let me know How to create dynamic columns in the data window using modified method. Thanks in Advance Rami Hi, 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. Thanks ! Simeon 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? If yes, any reference can be read? Thx..... ...

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? Thanks 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: 1. field_name 2. table_name 3. where_clause 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 + is_where_clause 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...

Web resources about - Dynamic column from powerscript to SQL ? - sybase.powerbuilder.general

Component Object Model - Wikipedia, the free encyclopedia
Component Object Model ( COM ) is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable ...

Aivosto - Analyze, Document and Flowchart Source Code
Programming tools for software developers. Visustin - Flow chart generator. Project Analyzer - VB code review and optimization.

FilmMakers.com Film Store - Books / Video / Lighting
Home Page Contests Indies Features News Resource Links Advertise With Us Film Makers .com Film Store - Video / Camcorders Digital and Video Editing ...

directzzt - ZZT recreation in .Net, using DirectX and great extensibility - Google Project Hosting
This project aims at building ZZT, offering great new features in terms of gameplay, scripting, all together with being able to use the ZZT-worlds ...

PB Ultimate Suite - Modernize your PowerBuilder Interface
... a wide range of PowerBuilder GUI controls to help you change the look of your PowerBuilder application. All controls are written in pure PowerScript ...

PowerToTheBuilder - PowerBuilder UI Controls
... offers a wide range of GUI controls to help you change the look of your PowerBuilder application. All controls are written in pure PowerScript ...

The Big List of 256 Programming Languages
... OpenCL OpenEdge ABL OPL Oz Paradox Parrot Pascal Perl PHP Pike PILOT PL/I PL/SQL Pliant PostScript POV-Ray PowerBasic PowerScript ...

Java Threads - Real's Threads
Real's HowTo Custom Search Java Language String and Number Applet AWT Swing Environment IO Javascript interaction JDBC Thread Networking JSP ...

Windows XP tips, Vista news, Windows Support, and technology news
Here are some posts that talk about Windows Longhorn, or, Windows Server 2008. Longhorn Server to be christened Windows Server 2008 Microsoft ...

Power.com wants to let you interconnect with all social networks
Power.com, the latest company that wants to bring you social networking Nirvana by letting you update all your profiles from a single place, ...

Resources last updated: 2/5/2016 12:24:57 PM