Questions tagged [format]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
32 views

In MySQL query, VARCHAR(100) gets output as "[partnumber]" although in a query with more columns, it is still shown as 'p-12345'

This is a bad question since I only made a mistake in selecting by chance a client that had garbage data and must have changed the where condition during tests, and it was also a problem of a join ...
user avatar
1 vote
1 answer
140 views

Dynamic trigger function to delete oldest rows of a table

I am trying to generalize a trigger that deletes the oldest rows in a table as new rows are added. Since the number of rows to retain depends on the table, I am passing that number to the trigger ...
user avatar
-1 votes
1 answer
635 views

PostgreSQL Query - how to subtract timestamps and format durations (with builitin functions or otherweise)

I am looking for a solution to a problem with a select statement where I am trying to display the sleep duration. Sleep Table Here is the select statement I have so far: select wakeuptime,hour from ...
user avatar
0 votes
0 answers
27 views

Upgrade MySQL Version, need I also upgrade the database as well?

I am running MySQL 5.6.51. And I notice that there is MySQL 8.x. Based on https://severalnines.com/database-blog/tips-for-upgrading-mysql-5-7-to-mysql-8, I need to first upgrade from 5.6.x to 5.7.x, ...
user avatar
  • 165
0 votes
0 answers
135 views

How to run query to convert undefined JSON fields into a row dynamically

Related to this answer I found a solution above to get undefined JSON files into rows. However, I need to run query twice so I modify the query to run it once. I tried to run the query returned from ...
user avatar
  • 127
2 votes
1 answer
72 views

Microsoft Access: Using other fields in an Autonumber

I'm trying to use Microsoft Access to start an employee database. However, I want the display of the Employee ID to be the initials and then their number. For example, John Smith with the ID 0002 is ...
user avatar
  • 21
1 vote
1 answer
454 views

How to alter tables safely to set row_format as Compressed or Dynamic in Mariadb Galera Cluster?

We have some tables with row_format=Compact. The biggest table is around 30Gb, so how safely i can alter tables and set the row format as Compressed for the big table and Dynamic for other three ...
user avatar
0 votes
0 answers
23 views

Change Table format from within MySQL 8?

Is there a mysql command to change the output format of a table? Specifically, I'd like to get rid of the formatting '-'s and '+'s: +------+------------+ | ID | Name | +------+------------+ | ...
user avatar
-1 votes
1 answer
92 views

Is there a good SSMS T-SQL code clean up / formatter plugin? [closed]

I'm looking for a good plugin that will automatically do things like upper case all keywords, indent lines appropriately, maybe brackets around reserved words being used as names / aliases, etc.
user avatar
  • 25.6k
0 votes
1 answer
359 views

Default value format of a stored procedure parameter(of datatype : money)

With my query: SELECT (CAST(0.00 AS MONEY)) I am expecting a result : 0.00 But it shows me the result: 0,00(with comma) I checked this query ,when i found that,the CREATE PROCEDURE script ...
user avatar
0 votes
2 answers
74 views

How to add 6 hours on MSSQL with format

I am currently using SELECT FORMAT (getdate(), 'MM/dd/yyyy, hh:mm:ss tt') as date The output is in the format I need, but is off by 6 hours. 05/30/2019, 06:26:01 PM I just need to add 6 hours ...
user avatar
  • 3
1 vote
1 answer
580 views

Format for recording RGB color in MySQL [closed]

React client is sending color to my server with this format {"r":1 "g":8 "b":5 "a":2}, for instance. I'm not sure what is the best way to record color in MySQL. I don't want to use this data in ...
user avatar
0 votes
2 answers
5k views

How to change the SQL Server Backup file (.bak) file default icon?

As I would like to say that by mistake the SQL Server 2012 backup file (.bak) open with wordpad. Due to this reason all backup files of SQL Server (.bak) file change with wordpad icon in entire the ...
user avatar
1 vote
2 answers
806 views

Update selected data from same table column as currency

I am trying to update selected data from a table column and format this data as currency. My table column holds strings that have both mixed whole numbers and already formatted data. This was due to ...
user avatar
  • 11
0 votes
2 answers
4k views

Is there a way in sqlite3 to set .width of all columns to be equal to the width of the column header?

I am using: SQLite version 3.21.0 I look for away to prettify my SQLite SELECT shell output (to make it more human readable, in essence). This answer helped me a lot. Though, now I am wondering if ...
user avatar
7 votes
1 answer
2k views

Does lightweight pooling disable built-in CLR facilities?

Running SQL Server in fibre mode (lightweight pooling) disables the use of SQL CLR: Common language runtime (CLR) execution is not supported under lightweight pooling. Disable one of two options: "...
user avatar
  • 72.4k
0 votes
1 answer
70 views

Txt format from Bank

I'm working on a service that allows users to store data from the bank, but banks give me their account statements in different formats, one of them is the following 68520157286 ...
user avatar
5 votes
1 answer
893 views

Getting year DATEPART from Unix date

In my database, the dates are retained as days elapsed since/before 01/01/1970, which I understand to be a Unix date format, eg. today is 23rd May 2018 and the value is 17674. I'm trying to run a ...
user avatar
  • 53
0 votes
1 answer
97 views

What format is this export of election data in?

I have a series of files I've downloaded from the Texas Ethics Commission (a misnamed . You can see an example of their layout in the ReadMe.txt. I've made an etl library which processes the ReadMe....
user avatar
  • 56.7k
5 votes
2 answers
5k views

Match phone numbers efficiently

For a mobile application we are considering validating a user based on their mobile phone number. In the app we will restrict the user input so that it will be stored in the following format: +...
user avatar
  • 153
2 votes
1 answer
4k views

How to store international phone numbers in PostgreSQL? [duplicate]

What is the correct way to store phone number data after applying a new mask for user input (example for UK; 44 07400 123456) if the type of the existing column is character varying(32)? Does storing ...
user avatar
  • 135
0 votes
1 answer
8k views

Can't get my SQL query to filter by dates like I want

I have a query where I want to exclude rows if a date column has any one of a set of dates. I am having trouble figuring how to return the correct result sets without filtering one month at a time. ...
user avatar
4 votes
1 answer
3k views

Cast all boolean fields in a SELECT * query to integer

In PostgreSQL, I can cast individual boolean fields to integer when I want to get 0/1 output instead of f/t. SELECT some, thing, mybool::integer FROM mytable; But is there a way to ask PostgreSQL to ...
user avatar
  • 495
0 votes
1 answer
2k views

Field Terminator Problem in Format Files

I have a data file in txt format and I used to load it with Bulk Insert in the following command: Bulk insert [table1] FROM 'data.txt' WITH ( FIELDTERMINATOR ='|', ROWTERMINATOR ='...
user avatar
  • 673
7 votes
2 answers
9k views

Differences between .dump and .sql in pg_dump PostgreSQL

I'm trying to take a backup of schema using pg_dump like, $ pg_dump -U ganapathy -n hotel_management > ganapathy_schema.dump It create the backup, But I can't restore it using pg_restore. It give ...
user avatar
  • 473
1 vote
1 answer
38 views

Concatenating Strings & Using FORMAT Together - NOT WORKING

I'm literally pulling my hair out trying to use the FORMAT function to format a date into a simple string. Please someone pull the pin and tell me what stupid thing I'm missing! Works: SELECT TOP ...
user avatar
  • 173
1 vote
3 answers
3k views

Why does formatting a time with AM/PM specifier return null?

I have a query where a formatted expression is returning null: declare @FormatString nvarchar(max) = N'hh:mm tt' select M_STARTTIME as [Memo Time 1] , convert(time,M_STARTTIME) as [Memo Time 2] ...
user avatar
6 votes
2 answers
15k views

Insert custom header row in BCP output

Long story short we have a database here that manages some employee data such as email, first name, last name, etc. Our company bought into this SAP Based expense report system :| that needs an ...
user avatar
  • 289
11 votes
1 answer
459 views

How to export the output of sp_AskBrent?

We have an instance that randomly spikes the CPU. I want to create an alert that fires on CPU over 90% and automatically calls a job that runs sp_AskBrent and emails me the output. However, the output ...
user avatar
  • 111
2 votes
1 answer
4k views

Query result in a daily date from a date range selection Postgres 9.3

I need to make a report that will output a result in a daily row result based on the datarange selected. Example: Table: sales ->id ->type ->gross ->created_at ->updated_at For ...
user avatar
3 votes
2 answers
77k views

How to format sql-plus-spool-file to *.csv with all columns in one line and row-content with linebreaks as one field?

I am not a professional, sorry. But perhaps you can help me anyway ... I have a table with 27 columns and within the rows data with linebreaks. When I try to export selected rows with sql-plus spool,...
user avatar
1 vote
0 answers
463 views

Does Postgres have a function for converting text into ASCII escaped or HTML escaped text?

Is there a builtin Postgres function that converts multi-line text into ASCII escaped or HTML escaped form and vice versa? I need to store multi-line text as name=value pairs, basically line .ini ...
user avatar
  • 905
0 votes
1 answer
1k views

Does PostgreSQL have a built in option for converting multi-line text to single line?

Does PostgreSQL have a built in option for converting multi-line text to single line? I need to store multiline text as Name=Value pairs, basically line .ini files, but need to convert Value back to ...
user avatar
  • 905
1 vote
3 answers
2k views

How to select different format of the date in mysql

I have this table and I can't change its format to yyyy-mm-dd because I have so many scripts that are related to this format dd-mm-yyyy. It would be a mess if I change its format. Id date ...
user avatar
1 vote
1 answer
774 views

Date format on the output of cmdshell dir C:\ /TC

I would like to ask you guys if anyone of you had this trouble before. In SQL I read the create time of the file like exec master.dbo.xp_cmdshell 'dir C:\ /TC' which gives me; 07/14/2009 04:20 ...
user avatar
  • 111
3 votes
1 answer
944 views

Improve select query performance

The following select query from my application is taking more than 200ms. The table has around 2 million rows. Is there any ways to improve the performance of this query ? select count(id) from ...
user avatar
  • 181
0 votes
0 answers
39 views

loading k:v pairs from DB into JS Object

I'm creating a single player web RPG. I'm debating the following method of storing/retrieving quest items per player id: In userstats table, have a quest_items column of type mediumtext, where I ...
user avatar
  • 213
0 votes
1 answer
646 views

How to interpret and modify a dBase (.dbf) file?

I'm working with dBASE (.dbf) files for a project using a GIS software because it seems that they are more efficient. I've converted several .xml files to .dbf with OpenOffice 3.4 and loaded into the ...
user avatar
  • 101
0 votes
1 answer
1k views

SQL output formatting

I want this: "ACCOUNT_ID","MAJOR_VERSION","MINOR_VERSION","COUNTRY","ACCEPTANCE_TIMESTAMP","AGREEMENT_ID" "abcdefgh-1234-5678-ijkl-mnopqrstuvwx","20110901","1","CN","1329574013737","tos" But I get ...
user avatar
  • 103
3 votes
2 answers
2k views

SQL*Plus default output format

I have noticed that using the same SQL*Plus client to connect to different Oracle database result in different outputs for the same SQL query. Database 1: C:\Oracle\instantclient_10_2>sqlplus ...
user avatar
  • 33
6 votes
3 answers
14k views

How to get SQL Server 2012 to use the invariant culture in format()?

This has now been posted to Connect: The invariant culture identifier is rejected by the FORMAT() function in SQL Server 2012. (Connect has been retired.) This has now been posted to feedback.azure....
user avatar
  • 1,342