SQLite Read Column - database

I have a SQlite Database with an id,name,number.
My problem is that I need a command which gives me the name connected with an AutoComplete function in an editView and in another editView there should stand the correct number related to the name. For example: I have the name rice and the number 50. I want the rice in the first editText and connected to the AutoComplete and the number 50 in another editText.
I am looking up the internet and also some manuals for SQLite for that, but it seems like I am too blind to find the right command. Someone has a suggestion for a tutorial where this is shown or someone has the right command for me to read this information out of my database.

SELECT number FROM table_id_name_number WHERE name = 'rice';

Related

In SSMS, what is the number that appears in brackets after the username?

Just out of curiosity, but I notice it changes seemingly at random, and I cannot find any documentation online for it at all. I have tried Googling it, and I fear I am poorly wording my search terms to find it.
I'm trying to workout what the numbers in brackets are after the username that is executing a query in SSMS are or for?
In the tab name or the window title, it'll appear like this:
SQLQuery19.sql - server_name.db_name (NETWORK\user (525))
The number seemingly changes when I open a new query at different times, and it doesn't seem to increase or decrease with any sort of pattern. Any links to documentation or brief explanation would be great.
That's the session_id - you can confirm by running SELECT ##SPID; in that window.
See https://learn.microsoft.com/en-us/sql/t-sql/functions/spid-transact-sql

Informix DB; query output, forcing table output?

All..
I am currently using some systems that has an Informix DB on some older IBM AIX OS based systems. I have found myself needing to use the command line "dbaccess" feature to make some quick queries. Informix has this really annoying habit of return output in this format:
employee -1
record_desc Update
field_id 2
value
opr_activity_date 20150831
opr_activity_time 1
employee -1
record_desc Update
field_id 2
value
opr_activity_date 20150831
opr_activity_time 1
employee -1
record_desc Update
field_id 2
value
opr_activity_date 20150831
opr_activity_time 1
MySQL, MSSQL, etc.. all output something more readable in table format..
city state zipcode
Sunnyvale CA 94086
San Francisco CA 94117
Palo Alto CA 94303
Redwood City CA 94026
Los Altos CA 94022
Mountain View CA 94063
Palo Alto CA 94304
Redwood City CA 94063
I noticed that Informix will/can output in a column/table format, but I have not figured out any rhyme or reason as to how it decides the flat versus the table format.
Any idea how I can force Informix to always display in column/table output via the command line?
Obviously, this is not an issue when I am near my computer and can use my GUI tool to query the DB...
Unfortunately, there's no way to control this behaviour in DB-Access.
If the width of the selected columns (plus a little white space) exceeds the width of the terminal, DB-Access switches to that block format, because it doesn't support sideways scrolling. That's the rhyme and reason.
You can try messing around with your terminal settings so that DB-Access is aware on start-up that the terminal width is wider than 80 characters, but I've always found there's more luck than science to that, and you'll still trigger the behaviour on some queries and not others.
When I need to do what you're describing - ad hoc, simple queries for troubleshooting etc - I tend to work within VIM rather than DB-Access, and use a macro to run the query and format the output. (This is using DBI::Shell behind the scenes.) I've also got a program that accepts either a table name or SQL statement and outputs tab-delimited, CSV or an old-school ASCII character formatted table of the results. This is also perl based. I could publish either of these if there's interest in them.
I think Jonathan Leffler's SQLCMD program can also be used in place of DB-Access to generate arbitrarily wide output.
Ok..
While I found the answers RET provided to be correct and pretty much sums up what I have been able to find on the net, I also found some work-arounds that enable the ability to get what you want, but in a kludgy way! Thanks Informix! :(
Open two terminal windows to your DB system, and launch the dbaccess and authenticate and connect to your database.
Next perform the following:
unload to /home/(user)/out ...the query...
Example:
unload to /home/jewettg/out select * from books_checked_in;
It will output the query results to the file and return the row-count of the return result.
On the second terminal, and here is the cool thing, run the following command:
column -t -s '|' /home/(user)/out
This will grab the content of the "out" file, and convert the pipe-delimited content to space-delimit content and output it to the screen.
Like I said, kludgy, but it works!
You can do this by setting the DBACCESS_COLUMNS environment variable. It is supported from version 12.10.xC9.
Example:
export DBACCESS_COLUMNS=1000

Using a thesaurus with full text search is not working, possibly I am loading US english instead of British English

I've created a thesaurus file and loaded it as per the example.
I have a database with a table that is full text indexed.
I loaded it using 1033 which is 'English' according to the MSDN article here
It took a long time to load (4 minutes) it's pretty huge, so I know that it loaded it.
There is also a file for British english which is possibly what my SQL is using which would explain why it didn't work. However the number isn't listed on that chart so I do not know how to load it.
Assuming that's the problem, all is dandy. However I also can't find anything that suggests the thesaurus will simply work automatically on any free text query eg. CONTAINS so I don't know if I have to do something to my free text catalog (couldn't see anything, but you never know).
Any ideas?
Additional information:
In my tsenu.xml file:
<XML ID="Microsoft Search Thesaurus">
<thesaurus xmlns="x-schema:tsSchema.xml">
<diacritics_sensitive>0</diacritics_sensitive>
<expansion>
<sub>John</sub>
<sub>Jon</sub>
</expansion>
</thesaurus>
</XML>
I then ran this:
EXEC sys.sp_fulltext_load_thesaurus_file 1033;
select * from Cats where contains(CatName , 'Jon', language 1033)
There are records for 'Jon' and 'John' but the results are not using the thesaurus to show me alternatives.
try
WHERE CONTAINS(CatName , 'FORMSOF (THESAURUS, Jon)')
using THESAURUS can be a bit tricky sometime, I havent used FTS for a long time but I remember sometimes , it will only return THESAURUS values not the actual value if it is contained in the data. for example if you are looking for thesaurus values for 'Jon' if there is a 'Jon' is data it will not return 'Jon' but will return all the Thesaurus for Jon, strange but this is how it works.
if you are looking for two words is something like
WHERE CONTAINS(CatName , '"Word1" AND "Word2"')
To search for John Smith I think you can do something like
WHERE CONTAINS(NAME, 'FORMSOF (THESAURUS, Jon) OR "Smith"')
Make sure to specify which language you want to use by using the optional language parameter when using Contains or FreeText
Contains and Free Text Information
I also looked at the chart and British English LCID is 2057.

What is the best way to handle Chinese names in Salesforce?

Salesforce separates family and personal names according to western convention.
That is the first name is personal and the last is a family name. This can be changed by changing the salesforce locale (say from the US to China) so that a the first name is the familyname and the last name(s) are personal
So in the vanilla SF John Smith appears as John Smith. If you switch to the Chinese localisation it would appear as Smith John.
Equally in vanilla Lim Keat Song would appear as Keat Song Lim, but would be correct in the chinese localisation as Lim Keat Song.
My problem is that about 30% of my contacts have East Asian names and so neither localisation is entirely satisfactory.
What are the the best ways of resolving this on a standard contact object?
I've asked the question on salesforce and as far as I can see there isn't much on this on google.
I'm asking this because whilst I can solve it - probably along the lines of the SD question - it's probably a known problem and I would like to find the best solution rather than reinventing the wheel.
Just for your idea.
We add two custom fields as Formula on the Contact object.
One custom field called Last Name refer to the Standard Last Name field on the Contact,
the other called First Name refer to the Standard First Name field on the Contact.
Therefore, you don't need to do any data import to these custom fields, but only define how to display your customized Last Name and First Name fields in the Contact display.
And this layout of Last Name and First Name will not change with users' localisation setting.
This may be not a perfect way to solve this, I wish it would help.

Database in conjunction with Barcodes

This is sort of a broad question - hope I'm posting in the right board ....
How can I go apart setting up a database (Im thinking about access here? )
I want to set up some fields for my company - such as name , number , address , email address etc etc.
I have a dymo label printer to print out the barcodes. Ive tried inputting the information on the barcode itself but the barcode becomes 'too big to print' , so I want to be able to link a database to the barcode so when its scanned it will load up all the information.
Sorry I have no code - I just have no place to start ):
Cheers for the help!
If the barcode is too large, you can change its size in Properties in DYMO Label.
There is a function in DYMO Label called Import Data and Print. You can design a label with barcode and text objects, then select a file and link columns to objects (basic drag and drop). I hope that answers the question.

Resources