I would do something like this:
SELECT substring(ContractTerms, 0, 1000),2field,3field
FROM ContractsTest
WHERE refnum = '1'
Then you can perfectly do the while with the fetchrow, and asign the alias at the same time. That would be something like this:
while (@reg = $sth->fetchrow())
{
$results{$ContractsTest_ContractTerms} = $reg[0];
$results{$alias_2field} = $reg[1];
$results{$alias_3field} = $reg[2];
}
The are many ways to fill the hash. That's just an example...
| Craig Cardimon <[EMAIL PROTECTED]>
Enviado por: [EMAIL PROTECTED] 29/04/2005 20:38
|
Para: ActivePerl <[email protected]>, [email protected] cc: Asunto: SELECT substring of column into a variable |
What I'm trying to do looks something like this:
SELECT substring(ContractTerms, 0, 1000) "$ContractsTest_ContractTerms"
FROM ContractsTest
WHERE refnum = '1'
I'm using Perl 5.8.6.811 on Windows XP Pro. I'm using Win32::ODBC to
connect to a SQL Server 2000 database.
I'm printing out the results using a hash within While FetchRow loop.
I can retrieve the other columns just fine.
ContractTerms is a problem because it is a text column and can be huge.
If I include it in the SELECT the whole thing bombs. I'm killing the hash.
As I don't need the entire column, but merely a portion of it, a
colleague suggested I trying selecting a substring of that column into a
variable or alias.
I have tried other variations, but it won't work.
-- Craig
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0517-5, 04/29/2005
Tested on: 4/29/2005 2:38:41 PM
avast! - copyright (c) 1988-2004 ALWIL Software.
http://www.avast.com
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
