m******y 发帖数: 588 | 1 When I'm running EXEC master..xp_cmdshell 'osql .. test.sql ..', I'm not
able to use @@ERROR to catch any error happening when executing test.sql
using osql utility. Is there anyway to error handling that? Thanks. |
|
m******y 发帖数: 588 | 2 Right now whatI did is to write the osql result into a log file and then use
EXEC sp_readerrorlog to find some keyword 'error' ,'invalid object' etc to
handle the errors.
Does anyone know a better way to do this?
Thanks again. |
|
a*******t 发帖数: 891 | 3 I ended up doing a file package, and have target server name passed in and
use osql to connect to the target server.
is there any performance degrad with osql? |
|
b********r 发帖数: 59 | 4 调用osql:
`osql -E -S ComputerName\InstanceName -i MyScript.sql -o MyOutput.rpt` |
|
a*****i 发帖数: 4391 | 5 Microsoft Database Envrionment?
It is basically SQL server stripped off all the fancy GUI managers, only
preserved osql as a command tool.
It is small and it is free for redistribution. |
|
j*****n 发帖数: 1781 | 6 osql is no longer supported by future version of SQL Server (2008?), but so
far is fine.
did not hear about if any down-grad if use it. |
|
b********r 发帖数: 59 | 7 Or take a look at osql or sqlcmd (both are command line
utilities for SQL Server 2000/2005) for complicated queries |
|
b********r 发帖数: 59 | 8 Sorry, it works only in SQL Server.
For SQL Server 2k5 or 2k8, you can use sqlcmd to replace osql |
|
c*****d 发帖数: 6045 | 9 就是把结果写到文本里
可以用osql -i -o |
|
u**d 发帖数: 211 | 10 用 sql server,有一个 Script,主要是 insert 之类的更新
我想在 sql server management studio 的窗口里执行文件里的
script,应该用什么命令?
网上搜了一下,sqlcmd osql 之类的都是在命令行执行
谢谢! |
|
i****a 发帖数: 36252 | 11 use the data type name directly, don't use ID.
if you are looking up what type a specific column is
SELECT t.name, c.name
FROM sys.columns c
INNER JOIN sys.types t
ON c.user_type_id = t.user_type_id
WHERE c.name = 'yourColumnName'
and are you using osql?? that's old school and hardcore... |
|
i****a 发帖数: 36252 | 12 dos cmd prompt + osql
j/k
SSMS + SQLPrompt |
|
j*******7 发帖数: 6300 | 13 提醒大家:osql这个工具一定不要再用了!!!它会把script中的non-ascii字符替换
成另外的字符,我们这儿出过事故。用sqlcmd,参数可以完全一样。 |
|