Ask Your Question
2

How can the collation of fields be altered during the use of OpenRowSet?

asked 2023-05-13 15:00:48 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-13 15:16:02 +0000

woof gravatar image

The collation of fields in OpenRowSet can be altered by using the COLLATE clause when specifying the field name in the query. For example:

SELECT [field1] COLLATE Latin1GeneralCIAS, [field2] COLLATE CyrillicGeneralCIAS FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=C:\Data.xlsx;IMEX=1', 'SELECT * FROM [Sheet1$]')

In this example, the collation of field1 is changed to Latin1GeneralCIAS and the collation of field2 is changed to CyrillicGeneralCIAS. This allows for proper sorting and comparison of text data in different languages and character sets.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-13 15:00:48 +0000

Seen: 11 times

Last updated: May 13 '23