从SQL Temp Table创建并执行XCOPY?

时间:2016-07-06 18:17:40

标签: sql-server temp-tables xcopy

我有一个临时表,我填充了这样的值:

FName   Project Plan    OriginalDoc NewDocName
Doe, John   ABC X   \\Path1\2\3.doc xyz1
Doe, John   ABC X   \\Path2\2\3.doc xyz2
Doe, John   ABC Y   \\Path3\2\3.doc xyz3
Doe, John   DEF X   \\Path4\1\3.doc xyz4
Doe, John   DEF Y   \\Path2\1\1.doc xyz5
Smith, Abbie    ABC X   \\Path2\5\3.doc xyz6
Smith, Abbie    DEF Y   \\Path4\2\4.doc xyz7
Smith, Abbie    GHI Y   \\Path231\22\13.doc xyz8
Smith, Abbie    GHI Y   \\Path11\22\33.doc  xyz9
Smith, Abbie    GHI Y   \\Path2345\34534\545.doc    xyz10

我想从每一行创建一个xcopy语句,然后执行它。这可能吗?

xcopy将是这样的:

XCOPY Chr(34) + @OriginalDoc Chr(34) + ' ' + Chr(34) + '\\Server\PathA\PathB\' + @Project + '\' + @Fname + + '\' + @NewDocName + '.doc' + Chr(34)

这有意义吗?有人能指出我正确的方向吗?

谢谢!

0 个答案:

没有答案