Solved

Does the -w option work with isql?

Posted on 1998-06-29
7
495 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now