Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [convert]

The tag has no usage guidance.

1
vote
2answers
44 views

Converting Varchar to Int error

I came across an issue today, and while I was able to fix it, I am unsure what caused the issue to happen. I have a column that is Varchar(20). It is used to store just year data (2010, 2011, etc.) ...
3
votes
1answer
584 views

Convert YYYY-MM-DD date (without time zone) to unix timestamp in Postgres

I've got a column of type date with the following value format: YYYY-MM-DD (eg. 2018-08-03). I want to get the unix timestamp equivalent of the dates, but without the timezone. F.e. the date 2018-08-...
2
votes
1answer
1k views

Mysql Pivot rows into dynamic columns with unknown number of columns

I have an output of a query as follows: bid | code | amount | ----------------------------- 2915 | BF | -10700.00 | 2915 | YQ | -300.00 | 2915 | YR | 0.00 | 2915 | YM ...
0
votes
1answer
157 views

Convert MS access to MySQL DB using php

We are creating a system that has a button for converting MS Access DB to MySQL. Is there a way to convert MS Access DB to MySQL using PHP? I would really appreciate any inputs on this one. Thank ...
-1
votes
2answers
80 views

sp_helpdb: how CONVERT created DATETIME

I like sp_helpdb, it gives me the chance to have the big picture. I found a blog that shows how to easily edit it. BTW, I would like to order the results by creation date. In order to do so I have ...
4
votes
1answer
300 views

Collate issues with wrong characters

Well, the problem is well known, but I'm looking for a smarter solution if there's one. For some reason the system doesn't recognize some characters and I can't compare the columns Here is an ...
0
votes
2answers
93 views

Converting from char(26) to datetime2

In course of a change I migrated a database from Oracle 12.1 to MSSQL 2016. Since the two databases handle date differently, I now need to move the fields from char(26) to datetime2. Output format is ...
2
votes
3answers
710 views

SQL - Convert text to a list of numeric values [duplicate]

Looking for SQL code to transform the text string '12,13,14' to this list of numbers +----+ | 12 | +----+ | 13 | +----+ | 14 | +----+ Example: table0.params (varchar) field contains this text: 12,...
0
votes
1answer
4k views

Want to change a timestamp date to an integer YYYYMMDD

I have this input "2017-07-21 15:31:04.853453" and I want it to return "20170721" as output. How can I do it using cast or convert function? My column input is the current time (CURRENT_TIMESTAMP). ...
3
votes
1answer
4k views

CONVERT() returns garbage with CLOBs in Oracle

I am looking to repair a table of data in Oracle, ideally via unprivileged SQL, which has had UTF-8 data inserted into a UTF-8 database, using the Latin-1 character set by mistake. The symbol β GREEK ...
3
votes
2answers
48 views

Transform a number in symbols in a MySql SELECT

I want to know if is possible to transform a numeric return (INT column) in a sequence of symbols direct in a MySQL SELECT. My table is like below: | ID | category | |-----------|----------| |...
1
vote
1answer
2k views

TSQL Convert FLOAT to STRING Truncation/Rounding Issue

SQL Server 2008 R2 Why when converting a FLOAT to a string (Varchar / Nvarchar) using Cast or Convert, does a rounding or truncation occur? Using CAST DECLARE @floatVal FLOAT = 4.76758527755737 ...
4
votes
1answer
530 views

Loading SQL Server from SQLite with image data

I am trying to load a SQL Server database table from a SQLite database. I have been unable to transfer the data between the two databases since there are: Difficulties in accessing the data in the ...
3
votes
4answers
6k views

Format value to configured number of decimal places

I want to format a number to display decimal places according to a configuration value specified in another table. If the configured value is NULL, the number of decimal places should default to 2 (...
3
votes
1answer
3k views

Pages to MB, multiple and divide or just divide?

When you are using things like sys.database_files it gives size of the file, in 8-KB pages, while many other things you are comparing to it to are in MB. There are a number of ways to convert the 8-...
0
votes
1answer
233 views

DateTime Conversion works for string value but for calculated value throws “out-of-range” error

So I keep getting an error and I have no clue what is prompting it. I have the SQL STUFF(STUFF(STUFF(CAST(((ETADate * 10000) + ETATime) * 100 AS NVARCHAR),13,0,':'),11,0,':'),9,0,' ') Which ...
0
votes
1answer
39 views

Creating rows in a table based on columns from another

I have an MS SQL 2012 DB with a table in the following format: account_id site_id IRA RFI XSS SQLi BDP Month 32501 112233 1 4 4 3 0 August,2016 32501 ...
1
vote
2answers
516 views

number of seconds to years-months-weeks-days-HH:MM-SS

I am running this all the time to get HH:MM:SS from a number of seconds: DECLARE @s INT SELECT @s = 23251 SELECT @s , CONVERT(TIME, DATEADD(SECOND, @s, 0)); when I want to add days to the ...
7
votes
3answers
12k views

Inserting date from string: CAST vs CONVERT

Consider the following two ways to convert a datetime varchar string into a date field: SELECT convert(date, '2012-12-21 21:12:00', 20) -- Only date is needed SELECT cast('2012-12-21 21:12:00' as ...
4
votes
2answers
9k views

How to escape XML characters in TSQL before converting to XML?

I have XML structure which is input param for my stored procedure. It contains element with & (which is escaped in XML). When I extract that element to VARCHAR I receive & which is not valid ...
1
vote
1answer
5k views

ERROR: Arithmetic overflow error converting float to data type numeric

I unfortunately have some bad data and need to work around it. I have a Parcel column in a spreadsheet with some parcels that have inadvertently been converted to floating point numbers. I posted a ...