Hi,
I want to change 2 default behaviors of ms-sql server within a connection.
1. All varchar (etc.) fields should be returned as UTF-8.
I know about field attribute collation and convert function,
but I want simple query like:
SELECT * FROM table;
to return all varchars as UTF-8, no matter how the fields were
defined and which collation.
In MySQL I execute: "SET NAMES 'utf-8';" after connecting to server
In PgSQL I use native function: pg_set_client_e ncoding()
2. Default datetime format is sth like this: "Apr 20 2008 12:01PM"
I just want all datetimes fields were returned as:
"2008-04-20 12:01:02"
I can do that with function convert() (style=20) but I want
(as in question above) a simple query like:
SELECT * FROM table;
to return date and time formatted as described above.
In MySQL and PgSQL the format "2008-04-20 12:01:02" is the default
one.
Is it possible to do that? If yes, please tell me how can I do that?
Wladyslaw 3 6688
On Thu, 10 Apr 2008 06:31:10 +0200, W?adys?aw Bodzek
<wbodzek_nospam @poczta_nospam. onet.plwrote:
You have of course seen the topics on UTF-8 in Books Online.
Generally speaking I think most people would consider these things
part of the presentation layer (or perhaps business layer), not of the
database layer (the topic of this newsgroup).
-Tom.
>Hi,
I want to change 2 default behaviors of ms-sql server within a connection.
1. All varchar (etc.) fields should be returned as UTF-8.
I know about field attribute collation and convert function,
but I want simple query like:
SELECT * FROM table;
to return all varchars as UTF-8, no matter how the fields were
defined and which collation.
In MySQL I execute: "SET NAMES 'utf-8';" after connecting to server
In PgSQL I use native function: pg_set_client_e ncoding()
2. Default datetime format is sth like this: "Apr 20 2008 12:01PM"
I just want all datetimes fields were returned as:
"2008-04-20 12:01:02"
I can do that with function convert() (style=20) but I want
(as in question above) a simple query like:
SELECT * FROM table;
to return date and time formatted as described above.
In MySQL and PgSQL the format "2008-04-20 12:01:02" is the default
one.
Is it possible to do that? If yes, please tell me how can I do that?
Wladyslaw
W?adys?aw Bodzek (wbodzek_nospam @poczta_nospam. onet.pl) writes:
I want to change 2 default behaviors of ms-sql server within a connection.
1. All varchar (etc.) fields should be returned as UTF-8.
I know about field attribute collation and convert function,
but I want simple query like:
SELECT * FROM table;
to return all varchars as UTF-8, no matter how the fields were
defined and which collation.
In MySQL I execute: "SET NAMES 'utf-8';" after connecting to server
In PgSQL I use native function: pg_set_client_e ncoding()
There is no setting for this in SQL Server. This is something you need to
deal with client side.
2. Default datetime format is sth like this: "Apr 20 2008 12:01PM"
I just want all datetimes fields were returned as:
"2008-04-20 12:01:02"
I can do that with function convert() (style=20) but I want
(as in question above) a simple query like:
SELECT * FROM table;
to return date and time formatted as described above.
In MySQL and PgSQL the format "2008-04-20 12:01:02" is the default
one.
SQL Server returns datetime values as binary values, and it is up to
the client to format it. You will have to ask in a PHP forum how to do
that.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx
Usually in this situation you will find a DBA programming...
If you want to do this, simply add the functionality into the Data
abstraction layer of your programming. Why does it make a difference
how long your SELECT queries are? Either you will add the
functionality or SQL will.
On Apr 9, 11:31*pm, W³adys³aw Bodzek
<wbodzek_nospam @poczta_nospam. onet.plwrote:
Hi,
I want to change 2 default behaviors of ms-sql server within a connection.
1. All varchar (etc.) fields should be returned as UTF-8.
* * I know about field attribute collation and convert function,
* * but I want simple query like:
* * * *SELECT * FROM table;
* * to return all varchars as UTF-8, no matter how the fields were
* * defined and which collation.
* * In MySQL I execute: "SET NAMES 'utf-8';" after connecting to server
* * In PgSQL I use native function: pg_set_client_e ncoding()
2. Default datetime format is sth like this: "Apr 20 2008 12:01PM"
* * I just want all datetimes fields were returned as:
* * * *"2008-04-20 12:01:02"
* * I can do that with function convert() (style=20) but I want
* * (as in question above) a simple query like:
* * * *SELECT * FROM table;
* * to return date and time formatted as described above.
* * In MySQL and PgSQL the format "2008-04-20 12:01:02" is the default
* * one.
Is it possible to do that? If yes, please tell me how can I do that?
Wladyslaw
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gerrit Holl |
last post by:
Posted with permission from the author.
I have some comments on this PEP, see the (coming) followup to this message.
PEP: 321
Title: Date/Time Parsing and Formatting
Version: $Revision: 1.3 $
Last-Modified: $Date: 2003/10/28 19:48:44 $
Author: A.M. Kuchling <amk@amk.ca>
Status: Draft
Type: Standards Track
|
by: David Sharp |
last post by:
I'm trying to find a way to format a FLOAT variable into a varchar in
SQL Server 2000 but using CAST/CONVERT I can only get scientific
notation i.e. 1e+006 instead of 1000000 which isn't really what I
wanted.
Preferably the varchar would display the number to 2 decimal places
but I'd settle for integers only as this conversion isn't business
critical and is a nice to have for background information.
Casting to MONEY or NUMERIC before...
|
by: shearichard |
last post by:
Hi - I have written some python to insert a row into a table using
MySQLDB. I have never before written SQL/Python using embedded
parameters in the SQL and I'm having some difficulties. Could someone
point me in the right direction please ?
The python looks like this :
import MySQLdb
import MySQLdb.cursors
conn = MySQLdb.Connect(host='localhost', user='abc,passwd='def',
|
by: Ken Wigle |
last post by:
All,
I would be very grateful for any help on this question. I have an
application in asp.net 2.0 where I dynamically create a datatable and then
bind that to a gridview. Unfortunately, the date column always shows the
date and time while I just want the short date. I have tried applying a
format string {0:d} but to no avail. I saw a lot of posts regarding the
htmlencode property but I do not know how to turn that off for a...
|
by: SparkByte |
last post by:
Now I know this has been asked before, but I am not getting the same error as mentioned in the earlier posts I could find.
Server is SQL 2000 Ent.
As you can see the table is for parsing Security event logs. This information is then used to create reports that are sent out to clients.
Problem:
The Strings and message values from the EventLogs gets truncated when pulled from the servers. (68 of them)
When I try to set the columns to...
| |
by: bryars |
last post by:
I want to write some SQL which results in an automatic conversion of a
datetime to a string in a format suitable for the Language of the
connection (either by explicitly setting the Language in the
connection string, or by setting the default language in for the user
used for the connection.)
The casting from string to datetime uses the language setting:
Data Source=localhost\sqlexpress;Initial Catalog=master;Persist
Security...
|
by: =?Utf-8?B?QW5kcmV3?= |
last post by:
hi,
my sp takes datetime in 'yyyyMMdd HH:mm:ss' format.
however my c# datetimepicker takes 'dd/MM/yy HH:mm:ss' format.
how do i convert/parse the datetime value from the datetimepicker to the sp
datetime format ? I've tried:
eg.
IFormatProvider culture = new CultureInfo("en-US", true);
|
by: Tim |
last post by:
Folks,
I'm trying to format a print string so that it reports progress whilst
processing a looping structure with a date time stamp appended to the
end of the string. This started out life as a simple need to create a
display that show progress to users when updating large tables in a
data warehouse in real time.
I have subsequently address that need through a different method,
however I am challenged by the seeming impossibility to...
|
by: Manikgisl |
last post by:
But the problem is we have dates in Varchar instead Datetime
While Converting Varchar To Datetime All four formats are unable to
Convert
ie
select Convert(Datetime,'18-11-2008 2:35:19 PM',102) -- error
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |