GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SqlServerSlackAPI/src/SqlServerSlackAPI/Deploy.sql at master · WCOMAB/SqlServerSlackAPI

Expand file tree

/

Deploy.sql

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
121 lines (111 loc) · 2.46 KB
/

Deploy.sql

Copy path

File metadata and controls

121 lines (111 loc) · 2.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
*
* Enable CLR in master database
*
*/
USE master
GO
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO
RECONFIGURE;
GO
/*
*
* Enable CLR in target database
*
*/
USE SlackTestDb
GO
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO
/*
*
* Remove any previously installed functions/procedures
*
*/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SlackChatPostMessage]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].SlackChatPostMessage
GO
/*
*
* Remove any previously installed assemblies keys from master
*
*/
USE master
IF EXISTS(SELECT name FROM sys.server_principals WHERE name = 'SqlServerSlackAPILogin')
DROP LOGIN SqlServerSlackAPILogin
GO
IF EXISTS(SELECT name FROM sys.asymmetric_keys WHERE name = 'SqlServerSlackAPIKey')
DROP ASYMMETRIC KEY SqlServerSlackAPIKey
GO
/*
*
* Install new assembly keys in master
*
*/
CREATE ASYMMETRIC KEY SqlServerSlackAPIKey FROM EXECUTABLE FILE = 'C:\temp\dev\github\SqlServerSlackAPI\src\SqlServerSlackAPI\bin\debug\SqlServerSlackAPI.dll'
GO
CREATE LOGIN SqlServerSlackAPILogin FROM ASYMMETRIC KEY SqlServerSlackAPIKey
GO
GRANT EXTERNAL ACCESS ASSEMBLY TO SqlServerSlackAPILogin
GO
/*
*
* Remove any previously installed assembly from target database
*
*/
USE SlackTestDb
IF EXISTS (SELECT * FROM sys.assemblies asms WHERE asms.name = N'SqlServerSlackAPI' and is_user_defined = 1)
DROP ASSEMBLY SqlServerSlackAPI
GO
/*
*
* Install new assembly to target database
*
*/
CREATE ASSEMBLY SqlServerSlackAPI from 'C:\temp\dev\github\SqlServerSlackAPI\src\SqlServerSlackAPI\bin\debug\SqlServerSlackAPI.dll' WITH PERMISSION_SET = EXTERNAL_ACCESS
GO
/*
*
* Install procedures and functions
*
*/
CREATE FUNCTION SlackChatPostMessage(
@Token nvarchar(max),
@Channel nvarchar(max),
@Text nvarchar(max),
@UserName nvarchar(max),
@IconUrl nvarchar(max)
)
RETURNS TABLE(
Ok bit,
Channel nvarchar(max),
TimeStamp nvarchar(max),
Error nvarchar(max)
)
AS EXTERNAL NAME SqlServerSlackAPI.UserDefinedFunctions.SlackChatPostMessage;
GO
/*
*
* Test created functions and procedures
*
*/
SELECT Ok,
Channel,
TimeStamp,
Error
FROM dbo.SlackChatPostMessage(
'<your slack token>',
'@devlead',
'Hello from SQL Server',
null,
null
)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.