1
SQLレコードをoutlook vcardsにエクスポートする必要があるため、結果行ごとに1つのvcardが返されます。誰もこれを行う方法を知っていますか?OutlookのVCardへのSQL結果?
SQLレコードをoutlook vcardsにエクスポートする必要があるため、結果行ごとに1つのvcardが返されます。誰もこれを行う方法を知っていますか?OutlookのVCardへのSQL結果?
たぶん、このような何か:
DECLARE @crlf char(2)
SET @crlf = CHAR(13) + CHAR(10)
SELECT
'BEGIN:VCARD' + @crlf
+ COALESCE ('N:' + COALESCE (Last, '') + ';'
+ COALESCE (First, '') + ';'
+ COALESCE (Mi, '') + @crlf, '')
+ COALESCE ('FN:' + FullName + @crlf, '')
+ COALESCE ('TITLE:' + Title + @crlf, '')
+ COALESCE ('ORG:' + Company + @crlf, '')
+ COALESCE ('TEL;WORK;VOICE:' + PhoneWork + @crlf, '')
+ COALESCE ('TEL;WORK;FAX:' + FaxWork + @crlf, '')
+ COALESCE ('TEL;HOME;VOICE:' + [PhoneHome] + @crlf, '')
+ COALESCE ('TEL;HOME;FAX:' + [FaxHome] + @crlf, '')
+ COALESCE ('TEL;CELL;VOICE:' + [PhoneMobile] + @crlf, '')
+ COALESCE ('TEL;PAGER;VOICE:' + [Pager] + @crlf, '')
+ 'ADR;WORK:;;' + COALESCE ([Address], '') + ';'
+ COALESCE ([City], '') + ';' + COALESCE ([State], '') + ';'
+ COALESCE ([Zip], '') + @crlf
+ COALESCE ('EMAIL;PREF;INTERNET:' + [email] + @crlf, '')
+ 'REV:' + { fn REPLACE({ fn REPLACE(
{ fn REPLACE(CONVERT(varchar, GETDATE(), 120), '-', '')
}, ':', '') }, ' ', 'T') } + 'Z'+ @crlf
+ 'END:VCARD' + @crlf AS vcard
FROM
yourTable
+1優秀な答え – u07ch