-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInstallScript.sql
More file actions
39 lines (33 loc) · 1.74 KB
/
Copy pathInstallScript.sql
File metadata and controls
39 lines (33 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Exec sp_configure 'clr enabled', '1';
Go
--if required
alter database TRX set trustworthy on;
--ALTER AUTHORIZATION ON DATABASE::APXFirm TO sa
go
--Drop assembly ExportSql
create assembly ExportSql
from 'C:\Dev\Utility\ExportSql.dll'
with permission_set = UNSAFE;
Go
--DROP PROCEDURE [dbo].[Sql2Csv]
CREATE PROCEDURE [dbo].[Sql2Csv]
@sql NVARCHAR (MAX),
@filePath NVARCHAR (MAX),
@fileName NVARCHAR (MAX),
@includeHeader INT,
@delimeter NVARCHAR (MAX),
@UseQuoteIdentifier INT,
@overWriteExisting INT,
@Encoding NVARCHAR(20)=''
AS EXTERNAL NAME [ExportSql].[ExportSql.StoredProcedures].[Sql2Csv]
GO
--TEST
Exec [Sql2Csv]
@sql = 'SELECT 1 as A, 2 as B',
@filePath = 'C:\Temp',
@fileName = 'Test.csv',
@includeHeader = 1,
@delimeter = ',',
@UseQuoteIdentifier = 0,
@overWriteExisting = 1,
@Encoding = '' --Unicode, UTF-8