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 | |
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... |