Solved

Does the -w option work with isql?

Posted on 1998-06-29
7
501 Views
Last Modified: 2008-07-03
It seems to me that the -w for isql does not work.  I am using release 10.0.4 or 11.1.1 of isql and it always truncates my output row to 258 bytes.  Can  somebody please comfirm this.  Thanks.
0
Comment
Question by:tsl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 10

Accepted Solution

by:
bret earned 50 total points
ID: 1098113
I can demonstrate that it works properly on Solaris.  It is probably your terminal that is
truncating the output (bcp wraps output rather than truncates it).

Is this on a UNIX box?  What kind of terminal are you using (xterm, sun, vt100, etc.)

Try this:

isql -Usa -P << EOF
use tempdb
go
create table isqltest(a char(255), b char(255), c char(255))
go
insert isqltest values ("a", "b","c")
go
exit
EOF
isql -Usa -P -w900 -o foobar.out << EOF
select * from tempdb..isqltest
go
exit
EOF
cut -c 240-260 foobar.out
cut -c 500-520 foobar.out

The first "cut" should show the "b" on the first line,
the second "cut" should show the "c".
0
 

Author Comment

by:tsl
ID: 1098114
I am using Solaris 2.5.1 and TERM=vt100.  When I try changing TERM to xterm same problem occurs.  Does not appear to be the TERM setting.  Any other ideas?

Thanks
0
 

Author Comment

by:tsl
ID: 1098115
This is one column that I am selecting.  The column is a shell script that will be run by the shell.  The column is like this
select
      "cd "+s.src_dir+"@"+"if test -f "+s.src_file+"@"+"do something etc@"

The @ symbols are turned into newlines and then the ouput is fed to ksh for execution.  Maybe one column has a restriction of 258.
0
Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

 

Author Comment

by:tsl
ID: 1098116
Yes, that was the problem.  By breaking the select line up into columns by adding commas makes it work.  For example:
select
      "cd "+s.src_dir+"@",
      "if test -f "+s.src_file+"@",
      "then@",
      "      do something@",
      "fi@"
      
0
 
LVL 10

Expert Comment

by:bret
ID: 1098117
Oh, yes.  An individual column cannot contain more than 255 characters, max.

You could probably rewrite this asfollows (note that it is good form to
name all your columns; starting the column names with
"--" converts them into non-executable comments for the shellscript):

select
"cd "+s.src_dir+"@" as "--",
"if test -f "+s.src_file+"@" as "---",
"do something etc." + "@" as "----"

-bret
0
 

Author Comment

by:tsl
ID: 1098118
Thanks alot for your help Bret.

-tom
0
 
LVL 10

Expert Comment

by:bret
ID: 1098119
Oh, yes.  An individual column cannot contain more than 255 characters, max.

You could probably rewrite this asfollows (note that it is good form to
name all your columns; starting the column names with
"--" converts them into non-executable comments for the shellscript):

select
"cd "+s.src_dir+"@" as "--",
"if test -f "+s.src_file+"@" as "---",
"do something etc." + "@" as "----"

-bret
0

Featured Post

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Successful collaboration among team members is essential for the growth of your business. When employees work together on projects, share ideas and communicate effectively they get better results.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question