Is it possible to create T-SQL file containing mixed Arabic (right-to-left) and English? - tsql

I have a database that caters for English and Arabic, and normally these are separate and cause no issues. I have a requirement to mix them - and this is not a problem in the database using nvarchar and when the user directly inputs the values.
However, we can't give the user direct access to the DB, so we wanted to write a simple insert script (xxx.sql file) and get them to edit the values...but we are struggling!
In Word, you can change language/text direction fairly simply to get the correct message, but when c&p'd into a sql file (plain text) the direction and/or encoding get messed up :(
Does anyone know how to achieve this?

Let user use any text editor which can produce correct text file. This file should be not sql script but a file with comma separated values. Then you will be able to bulk import these values correctly into any database structure you need.

Related

Is it safe to change the data source format to OLE DB database file when using a htm/html as the datasource to remove the limitation of 62 fields?

I have a mail merge datasource which is in htm/html format and it contains 70 fields. Since there is a limitation of 62 fields for such datasources(Reference).
Is it safe to change the datasource type to OLE DB database file in the confirm datasource dialog when selecting the datasource?
When you choose the "All web pages" type (and this is the default type in the case of an HTML file), you are in essence choosing a Word internal file converter to retrieve your data. The reason you end up with the concatenated columns is because
The internal converter is not primarily designed to "read data sources". It's there to convert a document in HTML format into a document in Word format.
Your HTML file contains a table in HTML format, so naturally, the converter tries to convert that into a Word table
However, Word tables can only have 63 columns, whereas HTML tables can have more, so the converter has to deal with that somehow. In this case, it concatenates the column data so column 63 ends up containing all the remaining data in the row.
Once the document is converted, Word uses the converted document as the data source. It's really no different from the situation where it uses a Word document as the data source.
If your HTML file actually contained (say) 1 paragraph of 70 comma-delimited values for each row of data, rather than an HTML table row with td cells, Word would end up treating the data as 70 separate columns (but it would also probably ask for the column delimiter every time you used the file, and you would have to ensure that commas in the data were correctly quoted.
In general, when you choose the "OLE DB Database Files" option, Word either knows of an OLE DB Provider type that can read the specified type of file, or it won't be able to read the file. In this case, what it tries to do is read the file using the Jet OLE DB provider (or in recent versions of Word, the ACE OLE DB provider).
The Jet/ACE providers are one of the mechanisms used to read Access .mdb/.accdb data, but these providers can read a number of formats such as Excel workbook data and plain text file data, using a number of what Jet/ACE calls "Installable ISAMs (IISAMs).
Since there is an IISAM for HTML format data, Word will try to get the data using that IISAM.
In that case, as long as the IISAM can actually read the HTML (it may not be able to read more modern versions of HTML very well) it works much more like the case where Word gets data from Excel. For example, if your HTML file contained two tables, you may get to choose which table to read, cf. an Excel workbook with multiple worksheets and perhaps named ranges.
Jet/ACE IISAMs generally do not support more than 255 columns. 70 shhould be fine. However, you may need to verify what the HTML IISAM does about
Columns with mixed data types (for example where some rows have numbers in them and others have text). When the Excel IISAM finds such data in the first 8 rows (by default) it tries to choose a format - somtimes that can mean that cells with text are read as if they contained "0". FWIW I do not think the HTML IISAM does that, but I would check anyway.
Columns with large amount of text, particularly if there is more than one such column. The IISAM is quite likely to truncate such columns to 255 characters or even less.
Columns with non-ANSI data (non-ANSI Unicode text e.g. Arabic, Hindi or Chinese text.
Other than delimited text files which will let you go over theat 255 limit if they are read by the internal converter, the only data source I know that will let WOrd see thousands of columns is SQL Server. Other servers with OLE DB providers such as MySQL might allow that too. If you have to use a very large number of columns, be aware that you may not see all the available field names in the relevant dropdowns in WOrd, but you should be able to insert the MERGEFIELD codes in manually in the usual way.
What is your current mailmerge connection method (OLEDB, DDE)? By switching to the OLEDB connection method - which is Word's default - you would not be changing the datasource type (only the connection method). Whether doing so will work with your datasource can easily be established by changing to OLEDB and leaving the datasource type alone. If it doesn't work, close the document without saving (or revert to the current connection method.
Regardless, the screen you're showing allows you to specify a datasource type, not the connection method. HTML files are not OLE DB database files and you'd be unlikely to find your datasource if you switched to that file type.
In any event, the 62-field limitation most likely only relates to the fields you can see via the GUI. If you know the field name, you can insert its reference via the keyboard. To do so, simply press Ctrl-F9 to create a pair of field braces (i.e. { }) and fill in between them with 'MERGEFIELD' and the field name, thus { MERGEFIELD FieldName }.

Conditional Formatting in Microsoft Word 2016 Table Cells

I have a table and it is for a test plan I am doing for a project, there is a column at the end of the table where the 2 values in it will be Y (passed the criteria) or N (didn't pass the criteria)
Is there a way in Microsoft Word to change the colour of the text on the row with the value of N at the end, this makes it easier to spot the places where it failed the criteria.
I know you can do the find and replace method but I was wondering if there was a way to do this automatically so when the user enters N it changes the whole row to red and when they enter Y it changes it back to normal.
Here is a screenshot of my table:
A point in the right direction to an article I may have missed or a direct answer would be greatly appreciated, thanks.
I see four ways you can go from here:
Either you create a VBA Macro which automatically jumps in once you change something in your document and updates the table. This will force you to save the document with the file extension *.docm.
Or you create two styles (of type character) which automatically format the table Cell and it's content as you like. You would need to guide the users how to use those styles by advising them or you could also provide separate buttons within your document to call a macro which would apply those styles. Also here the macro option would force you to save the document with the file extension *.docm.
Another option would be to use a Word document with an OLE Microsoft Excel object. The drawback is the users would need to know how to use this embedded Excel object.
The third way you could go is to use Microsoft Excel and use the inbuilt Conditional Formatting of Excel. If you need the results to be in a Word document you would still be able to copy the table back to Word.
Note:
I especially mention the document file extension *.docm because this can cause your document to appear dangerous when you send it by email. Perform a google search to read more about Microsoft Office documents containing macros.

Filtering fields containing foreign characters (Chinese) in Access 2010?

I have an access 2010 database that contains foreign characters and this data needs to be filtered, searched ect...
The data is stored in a SQL database using NVARCHAR. Visually they look good but when I go to search on the a field that has these characters I am unable to use the like function. I can get an exact match.
I am able to search for the foreign characters in SQL.
In the front end access 2010 DB that this is attached to when I filter on these columns I am unable to get an exact match or a like match.
It looks lke the sorting function works properly.
How can I get the filtering, sorting ect to function properly in Access 2010?
Thank you for your help.

How to retrieve keystroke/character mapping table from Microsoft IME program?

I want to know how to retrieve the character mapping table from ms IME?
When the user key in "gao xing", ms IME will display 高兴 in Chinese.
What I want to achieve is the other way round; when user key in 高兴, the program will convert it to "gao xing". In order to do that, I need a database / mapping table for this. And I guess MS IME contains this table already, it's just the matter how i retrieve it.
Do you have any idea how to do it?
There is no mapping that you can retrieve as a simple table. You could look into CEDICT for an open-source dictionary of Chinese with PinYin readings.

How do you create a two-column Word document where each column is a different file?

Is it possible to create a two-column Word document, where each column shows a different file?
I would like to print out a text in different languages, original and translation, side by side to learn a foreign language, but I cannot figure out how to do it.
Create a table with two columns, paste one document in the left column, the other in the right.
When you want to automate something in Word, one technique is to use Word's macro recorder to record yourself doing the same task (or a similar one). That results in VBA code that's pretty close to what you need. Take that code and adapt it for use in your program.