Convert Int Field To A String
how to convert a int field into a string... i've had a look at the mysql site but unable to look for the right function.
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Convert String
I have a database with records that contain a string date field in the following format: 22 jan 2005 15:02:22 GMT Any way I can have MySQL format that to a timestamp or other date format which I can use to calculate with? (need to flush records older then a certain date)
View Replies !
View Related
Convert String To Date
CREATE TABLE `quotes` ( `id` int(11) NOT NULL auto_increment, `title` text NOT NULL, `date` date NOT NULL PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=5675 ; INSERT INTO `quotes` VALUES (27, 'test', '25/10/2005'); --THERE ARE HUNDREDS OF VALUES TO INSERT
View Replies !
View Related
How To Convert NULL To String
My query is like the following: select * from person left join character using(id) where name LIKE '%smith%'; After running the above, nothing is returned because name is NULL in some cases. Is there a way to convert NULL to a string?
View Replies !
View Related
Convert Hex String Back To Binary
Using MySQL 4.017 on Win2k sp3: using MySQL built-ins: how can I convert a value stored as a hexadecimal string back to a binary string while logged into the shell? [color=blue] >set @t1=616263; >select 0x616263;[/color] how can I turn @t1 back into 0x616263? What is the syntax? I tried select concat('0x', @t1); this returns an unevaluated literal!
View Replies !
View Related
Convert String DateType To Date
I use mysql4.0.24 . Date is stored as string datatype ('14/01/2008') in mysql table.Now i want to filter the records based on the date column using <,> and between oprtators.But i am unable to do it.How can i convert the date from string data type to date datatype and chech the condition? i used cast() function. but it is not properly worked in mysql4.0.24.
View Replies !
View Related
Convert Hexadecimal String To Unsigned Integer?
How can I convert a string value containing a representation of a hexadecimal number to an unsigned integer? For example, given the string '00000ff', I want to convert this to unsigned integer = 255. In other words, if I create a hex string value from an integer using: lpad(hex(255),7,'0') results in string value '00000ff'; How can I unconvert this string value back to the integer value? UNHEX does not seem to work? The following function correctly converts a hex number to an unsigned integer: select cast(0x00000ff as unsigned) /* results in 255 */ However, I can not pass this same function a string: select cast('0x00000ff' as unsigned) /* syntax error */ select cast('00000ff' as unsigned) /* results in zero) */ I've also tried UNHEX without success: select unhex('00000ff') /* seems not to return anything */ select cast(unhex('00000ff') as unsigned) /* returns zero */ provoide example for this.
View Replies !
View Related
How To Convert A Varchar Field Into Proper Mysql Date Field?
I have a database in which the date is stored in varchar field in a following format: d-m-Y (06-08-2007), now the problem is that I want to change that field into mySQL date field as well as convert my older dates into MySQL date format i-e Y-m-d (2007-08-06).. There are about 300 old entries..is there a way I can do that automatically without manually re-entering the dates again?
View Replies !
View Related
Create A Field By Deleting A Part Of The String From Another Field!
I have a table for "Addresses", which has a column titled "Address" and the records in this column are a combination of house#, street name and street suffix, which typically looks like "100 Main Street". I am looking for a query result wherein a new column would be created which would have only the street name and the suffix and would eliminate the house #s, hence the result would look like "Main Street".
View Replies !
View Related
Convert Text Field
I am returning a Substring from the log_admin table from the description field. Can I convert the results to numeric? If so what is the syntax. SELECT adm_emp.FirstName, adm_emp.LastName, log.logid, log.employeeid, log.actiondate, log.sectionid, log.action, log.description, Substring(log.description,Locate('companyid = ', log.description)+12) companyid FROM log_admin as log join admin_employee as adm_emp on adm_emp.employeeid = log.employeeid join ref_section as ref_sec on ref_sec.sectionid = log.sectionid where log.employeeid in (10, 24, 25) and log.description like '%companyid =%'
View Replies !
View Related
I Need To Convert Date Type To String Type
I need to retrieve a Date type data from the database and present the data in my GUI as a String type. I've tried like this : ResultSet rs; Date data; data = (String)rs.getDate("ColumnName"); gui_label.setText(data); but they say inconvertible types... Can someone teach me the way so that I can retrieve Date type data from the database and present it in the GUI as a String type.
View Replies !
View Related
Comparing A Field With A String
I would like to run a select statement against a table, with a where condition that a field (less all it's non-alphanumeric chars) = a string. Ordering is important. For example the following should all evalute true, '1 2 3' = '123' '1"23' = '123' '1 23' = '123' '(abcde)' = 'abcde' where as these should evaluate false, '123' != '321' '1a23' != '123' 'abc' != abcd' I have a sinking feeling I need regex for this, which is unfortunate as I know none.
View Replies !
View Related
I Want To Check That A String Is In A Field
I want to select everything where a specific short string, is in the actual field. Eg, if I use a search string of alpine, it will be 'in' the field value Alpine Forests, so I will select the field that contains Alpine Forests. This is my SQL so far and it doesn't work SELECT * from packages2_tbl WHERE (INSTR(model, LCASE('Alpine'))) AND product_active = 'yes' ORDER BY model ASC" Has anyone got any ideas?
View Replies !
View Related
Convert Date String Into Date
I have created a database using data in a text file. Unfortunately the date column in the text file returns the date as day month date (e.g. Mon Nov 13). How do I convert these dates into the mysql format of YYYY_mm_dd ?
View Replies !
View Related
Query Field For Underscore String?
I have a field that contains an underscore. How can I do a query for the underscore since I just found that underscore really doesn't find underscore it is a wildcard in mysql. I need to be able to query for the actual underscore. For example. Select Title where Title LIKE '10_%' doesn't give me what I want.....
View Replies !
View Related
Numeric Sorting Of A String Field
I have an issue with sorting sail numbers for sail boats. Sail numbers may optionally contain a country prefix (can5003, or US345), hence the string. So.. I need to sort the sail numbers numerically by the integer component only (ignorning the chars). Sample data 1352 US 2005 74272 CAN801 Needs to look like this. CAN801 - sorted as 801 1352 - sorted as 1352 US 2005 - sorted as 2005 74272 - sorted as 74272 I don't quite know where to start.. a generated field that is 0 lpadded to some max length? - not sure how to drop the chars.
View Replies !
View Related
Searching A String Field In Database
I would like to have someone be able to search a my database. Here is how i would like it to work, but i am having a hard time figuring out how to code it. any help would be great. So for instance say i have a field labeled "activities" and i will have the user check off boxes to fill this field. Activities "baseball AND soccer AND volleyball" now i want someone to be able to search for "soccer" what would be the best way to search each person in the database for this attribute? Am i looking at this in the wrong way? Is there a better way to do this?
View Replies !
View Related
How Do I Update Part Of A String Value In A Field
I have information in a field as follows: |___col___| | AAXXAAA | I need up update all instances of the substring 'XX' in the 'col' field to 'YY', but I do not know how to structure the SET portion of my update statement to do this. Below is my update statement minus the set portion. UPDATE db.table SET col = <need help> WHERE col LIKE '%XX%';
View Replies !
View Related
Ordering Records Using Integer In String Field
I have table similar to: Id____Name_____________restProp 1.____Abc.150mm.aa_____567 2.____Abc.50mm.aa______654 3.____Bcd.150mm.bb____22654 4.____Bcd.18mm.bb_____2226 So as you can see there is an integer number (lenght of element) in Name string field. I need to sort results by: 1) Full Name 2) value in that name 3) other fields if needed so I should get: Id____Name_____________restProp 2.____Abc.50mm.aa______654 1.____Abc.150mm.aa_____567 4.____Bcd.18mm.bb_____2226 3.____Bcd.150mm.bb____22654 I know I can do this with php script, but maybe there is something easier/faster?
View Replies !
View Related
Using UPDATE To Insert A String Into String
Is there a way/function that will insert a string into another string using UPDATE? for example: I have a 'text (string) column' where I want to add '/' after every 4 characters. hex1hex2hex3 into hex1/hex2/hex3/ I was looking at the substring command, but it can only be used with SELECT?
View Replies !
View Related
Convert Database
We use the MS access database, I want to convert the database to mysql db , could suggest is there any tools / methods that I can export the table and data from access , and import it to the new mysql db ?
View Replies !
View Related
Convert DBF2MYSQL
I have tried to find a tool to convert DBF files to either a MySQL dump or entered directly into tables in my database.Ideally I want to run this export/update process every hour so this program needs to be able to be run by another application, maybe a cron job in Linux.Can anybody recommend a method of approaching this? I have attempted to use, DBF2MYSQL from the Debian packages but I get an error trying to run it, it tells me that the error is/ Code: Header value 0b not valid Couldn't open xbase-file
View Replies !
View Related
Convert MySQL To DBF
I would like to know if it possible to convert MySQL to DBF? I have managed to convert MySQL to DBF by using DBF2CSV to create the CSV and then using mysqlimport to get the data into a MySQL table. Has anybody used mysql2dbf successfully because I have recently tried running this program on Debian but I get this error message: "Segmentation fault" The program creates my DBF file but just doesn't fill it with any data, any ideas on this one at all?
View Replies !
View Related
Convert SQL Query
I'm trying to convert the following query to MySQL: CAST(CAST(dataMonth AS VARCHAR) + '/' + '01' + '/' + CAST(dataYear AS VARCHAR) AS SMALLDATETIME) BETWEEN '2005/01/01' AND '2005/08/01' AND InputMethod = 1; What this query is doing is taking two fields and stringing them together to form a date. The end result is used to check w/in the given date range. is the SMALLDATETIME considered a column alias when using a CAST function in MySQL? If so, then I can't use the alias name in the WHERE clause of a SELECT statement. Which is what is hanging me up. I'm just trying to take the data from two different fields and convert it to a date so I can use the result in the WHERE clause.
View Replies !
View Related
How To Convert *.ddl To *.sql File
I am using MySQL database server for my project but i have database file in form of *.ddl...but to run following mysql dump command, i need *.sql file... mysql dbname -uroot -ppass < test.sql Is it possible to convert *.ddl file into *.sql file...if possible can anyone give me an idea how to convert *.ddl file into *.sql file...then i can use it easily...I tried by saving this ddl file with sql extension...but when i run mysql dump command it failed because some of the statements in that ddl file are not supported by MySQL..some of those are CONNECT TO RXDATABASE; CREATE SCHEMA GENRXDB; SET SCHEMA=GENRXDB;
View Replies !
View Related
Convert M9M 2S4 To M9M2S4
I am trying to change postal code data in my mysql table. Current format is M9M 2S4 I would like it to be M9M2S4 I am just a user and not really a programmer or DB guy. I know how to run SQL queries on the table.
View Replies !
View Related
Convert Function
How can I convert a function (SQL SERVER) that returns a TABLE type and IS USED in queries, like, SELECT * FROM Item INNER JOIN myFunction(SomeParameter) ON Item.ItemID=myFunction.ItemID Here's an example (SQL SERVER): CREATE FUNCTION [DPVIEW71_0](@TransDocument nvarchar(255),@TransSerial nvarchar(255)) RETURNS TABLE AS Return (SELECT [TransDocNumber], [CreateDate], [DeferredPaymentDate], [PartyID], [PartyName], [TotalNetAmount], [TotalTaxAmount], [TotalTransactionAmount], [CurrencyID], [ContractReferenceNumber] FROM [BuyTransaction] WHERE [BuyTransaction].[TransDocument]=@TransDocument AND [BuyTransaction].[TransSerial]=@TransSerial)
View Replies !
View Related
Convert And Cast
I'm trying to convert binary strings that have been created using aes_encrypt('string','secret') to a text or character string. I know MySql does this with convert http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html But can you give me a small example using convert and cast where a binary string is converted to characters or text. The column that stores my binary data is called org_a. What ever i do i don't get any valid output. Just a 2 small exmaples using convert and cast (not aes_decrypt).
View Replies !
View Related
How Can I Convert Mysql 4.1 To 4.0
i have a phpmyadmin bacup of my databse from a server which is mysql 4.1 my ex-account terminated i couldnt convert it on phpmyadmin now new server is mysl 4.0 when i try to dump it it says Error at the line 26: ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Query: CREATE TABLE `access` ( `userid` int(10) unsigned NOT NULL default '0', `forumid` smallint(5) unsigned NOT NULL default '0', `accessmask` smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (`userid`,`forumid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; MySQL: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1' at line 6 i know this is becaue the version bcs i try on anther server i convert it via phpmyadmin but now i havent i phpmyadmin bcs ex-server terminate my account.
View Replies !
View Related
|