boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 请教一个在stored procedure 里用bcp的问题.
相关主题
why this Trigger hang the Process *** thanks thanks
面试问题How would you improve table insert performance? (give five or more ideas)
请教2个sql query 问题
[转载] Can anyone interpret this simple SQL?
query estimation shows cost 900%?
SQL help.
请问这两个SQL QUERY有什么错?
Why does this Stored procedure fail ?
anyone can help on this query, thanks!
誰來幫我開來開悄? Interesting SQL query
相关话题的讨论汇总
话题: query话题: insert话题: bcp话题: select话题: update
进入Database版参与讨论
1 (共1页)
S**H
发帖数: 1256
1
exec xp_cmdshell
'bcp "select..... query here" queryout " c:\test.dat"
有个问题就是,实际上double quote 里的query 很长. 现在只能写成个很长的一行.
如果换成 多行, 连编译都通不过.
请问如何 写成多行?
多谢!!!!
j*****n
发帖数: 1781
2
DECLARE @query VARCHAR(max)
SELECT @query = '"select ....'
SELECT @query = @query + 'line 2...'
...
SELECT @query = @query + 'line n "'
btw, do you have to have execute BCP in SP? I doubt it is a good idea...
S**H
发帖数: 1256
3
thanks
S**H
发帖数: 1256
4
Any better idea?
the case is : whenever there is Update/Insert on Table A, -->retrieve the
records--> appending the message according to whether it is a Update/Insert-
--> ouput the results into .*.txt file.
thanks!!!!
B*****g
发帖数: 34098
5
create immediate table

Insert-

【在 S**H 的大作中提到】
: Any better idea?
: the case is : whenever there is Update/Insert on Table A, -->retrieve the
: records--> appending the message according to whether it is a Update/Insert-
: --> ouput the results into .*.txt file.
: thanks!!!!

y****w
发帖数: 3747
6
弄个临时表最简单,调试方便不容易出错。你要形而上学那就玩玩这个,
CREATE TRIGGER [ schema_name . ]trigger_name
ON { table | view }
[ WITH [ ,...n ] ]
{ FOR | AFTER | INSTEAD OF }
******{ [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] } ------
[ WITH APPEND ]
[ NOT FOR REPLICATION ]
看标出来的那一行,sql server看来支持multi-event trigger. 你自己去问问google
怎么把他实现出来,因为我也没在sql server上写过这个。 弄好了最好回个贴或站内
我一下怎么做的。

Insert-

【在 S**H 的大作中提到】
: Any better idea?
: the case is : whenever there is Update/Insert on Table A, -->retrieve the
: records--> appending the message according to whether it is a Update/Insert-
: --> ouput the results into .*.txt file.
: thanks!!!!

j*****n
发帖数: 1781
7
Tidal has a SQL event that monitors table changes and it can trigger an
action to fire a job to do something... if your company has that...
1 (共1页)
进入Database版参与讨论
相关主题
誰來幫我開來開悄? Interesting SQL query
请教一个求职面试题:如何写一个SQL query求表中对角线的和
How to replace 0 with empty?
About INSERT IGNORE
再请教大牛一个问题
SQL Server 如何把日期自动加入文件名中?
问一个SQL Server的问题
这个query怎么写?
What does sum(2) mean?
stored procedure running 很慢的问题
相关话题的讨论汇总
话题: query话题: insert话题: bcp话题: select话题: update