By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,574 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,574 IT Pros & Developers. It's quick & easy.

Changing the day of week in SQL Server 2000

P: n/a
Dear All,

I have one field in my table which shows the day of the week. It is
showing

Sunday = 1
Monday = 2
Tuesday = 3

But i want Monday is the first day. I know i can use DATEFIRST to
change it but it works in Query Analyzerbut when i come and see my
table it is showing the old settings. Is it possible i can change it
permanently. Any help in this regard will be higly appreciated

Regards

S
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Neha

It is not clear what you are trying to do or how your data is being held,
posting DDL (create table statements) and example data (as insert
statements) will remove any ambiguity
http://www.aspfaq.com/etiquette.asp?id=5006

If the day of the week in your table is data it will need to be updated. If
it is currently held as a value 1-7
with Sunday = 1... then try the statement

UPDATE MyTable
SET DayOfWeek = CASE WHEN DayOfWeek = 1 THEN 7 ELSE DayOfWeek - 1 END

Using SET DATEFIRST will change the settings for the current session,
therefore you will need to make sure it is set currectly before issuing your
statement. Alternatively datefirst can be change if a different default
language is specified, to check the current language use sp_helplanguage
@@LANGUAGE. sp_helplanguage with no parameters will show you what the values
are for each language. To change the default language use sp_configure (see
Books online for more information)

John

"Neha" <ne********@hotmail.com> wrote in message
news:76*************************@posting.google.co m...
Dear All,

I have one field in my table which shows the day of the week. It is
showing

Sunday = 1
Monday = 2
Tuesday = 3

But i want Monday is the first day. I know i can use DATEFIRST to
change it but it works in Query Analyzerbut when i come and see my
table it is showing the old settings. Is it possible i can change it
permanently. Any help in this regard will be higly appreciated

Regards

S

Jul 23 '05 #2

P: n/a
John Bell (jb************@hotmail.com) writes:
Using SET DATEFIRST will change the settings for the current session,
therefore you will need to make sure it is set currectly before issuing
your statement. Alternatively datefirst can be change if a different
default language is specified, to check the current language use
sp_helplanguage @@LANGUAGE. sp_helplanguage with no parameters will show
you what the values are for each language. To change the default
language use sp_configure (see Books online for more information)


What you change with sp_configure is the default language for new
logins.

To change the default language for an existing login, use
sp_defaultlanguage.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.