Sunday, February 19, 2012

format column lengths

In Oracle sqlplus I always had a login.sql with statements like

column bldg_id format a8

which I could also use interactively on the sqlplus command line.

How can I do this in transact-sql ?

As far as I know, there is no equal command in SQL Server.

But for simple format purpose, you can try -Y or -y parameter for sqlcmd.exe

For more info, pls try sqlcmd /?

Thanks,

Zuomin
|||

You can use BCP with format files, where you can control lot of options..

See BCP on BOL

|||

Thank you both, but I'm just running the transact-sql available through Enterprise to SQL server, and I don't know what BCD is.

I learned I can do this:

oracle: col id format a8
transact-sql: select cast( id as char(8) )

|||Also, don't overlook OSQL if you need a handy command access. I've gotten more little jobs done with a good batch file and some OSQL than I can count.

John V. McCarthy

No comments:

Post a Comment