Weekday Names
Jan 4, 2007
Sql server 2000 -sql query analyzer
select datename(dw,'01-01-2006')
returns sunday
Now I do:
set language danish
select datename(dw,'01-01-2006')
returns sonday. But it should be søndag. Same goes for
saturday/lordag/lørdag
Tried substring'ing and ascii'ing/unicode'ing and it is AFAIK an o instead
of the special danish character ø.
Is this a "feature" or am I doing something wrong?
I "solved" it by doing
select case DATENAME(dw,'01-01-2006') WHEN 'lordag' THEN 'lørdag' WHEN
'sondag' THEN 'søndag' ELSE DATENAME(dw,'01-01-2006') END
but it sure aint pretty.
/jim
View 3 Replies
ADVERTISEMENT
Jan 31, 2014
I try to make the following:
select DATENAME(WEEKDAY,[date]) as DAY, sum(earnings) as Earnings
from myTable
where DATENAME(WEEKDAY,[date]
in ('monday','tuesday','wednesday','thursday','friday')
group by DATENAME(WEEKDAY,[date])
order by DAY
this query works very well except the last line. the last line causes SQL-Server to order the days in an alphabetical order.What do I have to do that SQL-Server orders the days according to their natural appearance (monday, tuesday, wednesday, thurs......)
View 2 Replies
View Related
Feb 27, 2001
Hi!
I´m experiencing problems with datepart(weekday,...) function. In particular with week 54 of 2000... (by the way, don´t make a bet about that, because Jan 1st. was saturday (last day of week) and year 2000 was a leap year!!!, so Dec 31 became the one and only case of 54 weeks... in our calendar).
Is there a way I can fix sunday as first day of week, instead using SET DATEFIRST in every procedure? (because "somebody" puts MONDAY as a default in spanish)
Thanx in advance,
César.
View 1 Replies
View Related
May 29, 2008
Hello Guys,
I'm going crazy tring to figure out how to generate a report that execute a Store procedure and then give me a total Per WeekDay and group it by Part Number.
For example my data should look like this
(PartNumber-Monday-Tuesday-Wednesday-Thursday-Friday-Saturday-Sunday-)
The report will give me a list of all available part and the sold sold per part per day.
Thanks in Advance.
View 8 Replies
View Related
Nov 25, 2013
Aim – To work out what day of the week a Closedate Falls on
Date format is of Closedate is “Year-month-Day†(varchar(50)
E.g.
2013-11-25
2013-11-21
2013-11-19
2013-11-18
Desired results
2013-11-25Monday
2013-11-21Thursday
2013-11-19Tuesday
2013-11-18Monday
View 3 Replies
View Related
Jan 25, 2008
Hi,
I have a transaction file containing a year's worth of transactions with a date/time field that tells me when the transaction took place. I'd like to write a view (or perhaps multiple views) that tells me the average number of transactions per weekday.
I've been messing around with DATEPART and I can calculate the *total* number of transactions that took place on a Monday, for example, but I can't figure how to do the *average* number. My problem seems to be calculating the number of Mondays there were in the year. Or overthinking it.
Any suggestions would be greatly appreciated.
Thanks,
Jennifer
View 5 Replies
View Related
Feb 18, 2008
Hi All,In ASP.Net, I am passing a date as a string formatted as yyyymmdd (e.g. 20080219) via an SqlParameter as follows:aSqlParams(0) = New SqlParameter("@DepartDate", inpDepartDate.Value)In the Stored Procedure (SP) I am using DATEPART(dw, @DepartDate).If I execute the SP from within SQL Server and enter a date, formatted as above, as tha value for the Parameter @DepartDate then DatePart returns the correct value (3).If I use the SP via ASP.Net it returns a value which is 1 less (2). When I execute the SP manually the resultant EXEC statement uses "@DepartDate = N'20080219'". Can something similar be done in ASP.Net when setting the SqlParameter? Thank you,
View 4 Replies
View Related
Sep 10, 2007
In a table, I store an integer to represent a day of the week (1 = sunday ) and then in procedures, compare that to datepart(dw, getdate()) to do alternative tasks on certain days.
If I have the number 1, is there a built in function to convert that to sunday or should one just write a function to do just that?
View 3 Replies
View Related
Oct 4, 2007
How can I set a different language (for example swedish) when using WeekdayName,
DatePart and FormatDateTime?
View 2 Replies
View Related
May 7, 2015
In my SSRS report i have a date parameter and i want to set to it a default value with a complicated logic. I arrived at this strange behaviour:
Today is May 6th, wednesday. If i use the following expression:
DateAdd("d",Weekday(Today(),DayOfWeek.Sunday),Today())
for the default time picker I get May 9th. If I use exactly the same expression in a textbox in the same report
DateAdd("d",Weekday(Today(),DayOfWeek.Sunday),Today()).ToLongDateString()
I get May 10th! The only thing that changes is the toString. Why are the two values different? I tried with different expressions and the difference arises when i start using Weekday(Today(), somevalue).
The result of Weekday should be independent from regional settings as I am forcing Sunday to be the first day of the week, right?
View 2 Replies
View Related
Mar 1, 2015
I am designing a package to export staging tables into a flat file.The names of the tables will be: TableAStaging_YYYYMM and TableBStaging_YYYYMM. As you can see the names of the tables will be changing each month.
The flat files will have similar naming: C:MyPathFlatFileTableAStaging__YYYYMM and C:MyPathFlatFileTableAStaging__YYYYMM.I want to run the package as an sql job in two steps, one for each table.I need to dynamically pass the table names and file names (together with the path) to the IS package.
View 1 Replies
View Related
Aug 11, 2015
As part if a recent requirement I have to export Chinese/Singaporean names in a CSV file. The data in the tables is a NVARCHAR(256).
I am using a FlatFile Connection manager where all the present columns from the table are exported as NVARCHARs. My understanding was that the Chinese/Singaporean names would blend seamlessly with NVARCHARs in place. But, they get garbled when pushed to the CSV.
Here is the connection manager setup
There are a lot of suggestions of fixing this by copying/pasting to a notepad file and changing the formatting... But I cant do that since the file is generated using a schedules SSIS package. How can I tweak the process to fix the issue?
View 4 Replies
View Related
Jan 22, 2004
Hi
I was wondering if anyone has an idea of how we could find the table names and column names of the tables in our Sql server database at runtime/dynamically given our connection string? Please let me know.
Thanks.
View 5 Replies
View Related
Jan 31, 2008
I'm going to be setting up DB mirroring between two SQL Server 2005 boxes. Since these are on two different servers, can the instance names be the same? Is there any reason NOT to do so if the mirror server is going to be used exclusively for DB mirroring?
For example: if the my primary DB is located on SERVER1INSTANCE1, can the mirror be SERVER2INSTANCE1 or do the instance names have to be different even though they're on different boxes.
Thanks!
View 4 Replies
View Related
Jan 21, 2004
I'm trying to do an update query that looks like this:
UPDATE
PAEMPLOYEE
SET PAEMPLOYEE.LOCAT_CODE = EMPLOYEE.PROCESS_LEVEL
FROM
PAEMPLOYEE A
JOIN EMPLOYEE B ON A.EMPLOYEE = B.EMPLOYEE
It's erroring out on the Employee prefix B.EMPLOYEE saying:
..."does not match with a table name or alias name used in the query"
Is it wrong or will it cause problems to have a field name the same as the table name?
View 5 Replies
View Related
Aug 3, 2006
Hello there. I'm trying to populate a drop down box with a list of all available instances of SQL server (express or not) available on a network. To list all instances I'm using EnumAvailableServers() in SmoApplication.
The issue is that the Instance column in the returned data table is always empty, and both the Name and the Server columns contain the same string -- the name of the computer the SQL server is installed. Locally I have SSE installed, the instance name is <computer_name>SQLEXPRESS, however, using Smo I can't seem to get to the either full instance name or just the instance name. I can't assume SQLEXPRESS, since there may be more than one installed.
Alternately I used EnumRegisteredServers() in SmoApplication.SqlServerRegistrations and that, while returning instance information (can be retrieved from the RegisteredServer in the returned collection), doesn't always return the remote SQL servers in the list.
Any idea how can this be done? Maybe I'm going at it the wrong way, maybe there's another class / method I need to use to retrieve all instances?
Thank you
View 6 Replies
View Related
Mar 4, 2008
hii all,can any one help me to get this information.
i am using sql server 2000 and i want to know:
1- all names of servers
2- all database names (catalogs) at specific server and only which the user created .
3- user name and password for each server.
thanks.
View 2 Replies
View Related
Aug 14, 2006
hi, can someone tell me how can i get all sql server names in my network. thanks
View 1 Replies
View Related
Dec 29, 2003
Hello,
Im trying to get the column names from a database and display them in textboxes. someone has already helped me by tellnig me that i need to use the FillSchema command. Which works just fine and I can see only the colum names in a datagrid when i bind it to that.
The problem is that I do not know how to extract the name of a column and put it in to a textbox ?
does anybody know how I can fo this ?
Thanks a million
Rob
View 3 Replies
View Related
Aug 24, 2005
Hi,How do I display the column names from my Sql server table?In asp3 the recordset allowed thisforeach key in rs ColumnName = key.name ColumnValue = key.valuenextHow do I do this in .Net?I want to use a DataReader so I can read through each record and only display the ones I want.TABLE_ONEColumn_OneColumn_TwoColumn_Threethanks,
View 1 Replies
View Related
Aug 1, 2000
Oracle provides for a table to have an alias name.
Does SQL Server 7 support alias names for tables?
Thanks!!
View 2 Replies
View Related
Sep 8, 1999
Are there any problems w/ installing SQL Server 7.0 on a computer with a name such as 05005sql? I know that SQL will take the computer name as the SQL Server name, however, I am concerned about the numeric beginning of the computer name. Any suggestions?
View 1 Replies
View Related
Mar 6, 2001
I have created a database which has a table whose name is 128 characters long; this table has a column whose name is 128 characters long. When I issue the command sp_helpconstraint table_name, SQL Server 7 returns the message "string or binary data would be truncated."
Any suggestions?
Thanks!
View 1 Replies
View Related
Sep 3, 2003
My company is going to start a Cancel web site so customers can cancel their future orders by simply filling out a form. I was wondering what would be the best way to compare the cancel db to db that is used to store customer information and order information.
The cancel website will only hold the name, address, and Credit Card Number used. There will not be a customer/order number. The simple Credit Card to Credit Card search will be easy but I was more worried about comparing the rest of the information in case the Credit Card search fail. I was told the "standard" look up was to take the first 3 letters of the first name and the last 3 letters of the last name. If that comes up with more then one record, take that set and see if the zip code matches up and/or part of the street address matches up (counting we do not have very reliable people inputting the information into the system is not going to help this search).
Anyway, any suggestions on comparing the data would be great.
Thanks ahead of time
View 4 Replies
View Related
May 24, 2004
When I am connected to an instance of the sql server using EM, can I find out how many other instances are present on the original server?
View 3 Replies
View Related
Mar 29, 2001
I have inherited a database which had no clustered indexes at all, only non-clustered. WHen I started experimenting with creating some I got error messages back complaining that the name already existed in sysobjects. I have come to find out they tool they use to create the indexes, names the index the same as exisiting table(isn't this a great idea). Other than my current problem, does anyone see other issues might run into. My thought is to drop all the indexes with the table names and recreate them with a better standard. Has anyone else ever run into or done this?
THanks
View 2 Replies
View Related
Oct 7, 2004
I have a database with a whole lot of records (over 70 mill) I am looking for a quick way to search the name fields for incorrect names and give me a count.
Example:
ttthomas
wwwagner
jonnnes
willllliams
fredrickkkk
collinssss
I mostly need it to search for 3 or more duplicate characters in a row, but through the whole name.
I am not sure if this is even possible.
Any help would be greatly appreciated.
View 1 Replies
View Related
Jul 23, 2004
Is it possible for MS SQL 2k to get confused when we have two stored proces that has the same name for their transactions and both stored procs are exec at the same time?
Example:
Create Procedure SP1
as
Begin Transaction TranName1
Commit Transaction TranName1
Begin Transaction TranName2
Commit Transaction TranName2
Create Procedure SP2
as
Begin Transaction TranName2
Commit Transaction TranName2
Begin Transaction TranName3
Commit Transaction TranName3
We are seeing some very weird data corruption but luckily its been way under 1%(something like 500 bad rows out of a few million). The only thing we can think of since it is such a very low number is maybe when blocking occurs SQL has trouble handing two transactions with the same name in its queue. Beyond that we have no idea what could be causing this issue.
View 2 Replies
View Related
Feb 7, 2005
Hi Is it possible to obtain an NT username (with T-SQL) from a user connecting to SQL Server with a SQL log in via ODBC? Thanks in advance
View 3 Replies
View Related
Jun 23, 2007
Hello,
I am using ADO controls for MSSQL Database. The server name on my machine is different from the server name on the machine where i am running my application. When i make changes to my application, i have to rebuild the connection on my ADO Control. Is there a way to create a server name on my developement machine to match the server name where i run my application?
Would appreciate any help.
View 5 Replies
View Related
Aug 6, 2007
I need to implement support for alternate names on the database I’m working on.
When a user looks up: “Antony Bigglesworth” the query would return both: Antony Bigglesworth as well as Tony Bigglesworth, would both exist.
Anyone has a best practice on this or has done this before?
View 8 Replies
View Related
Jan 2, 2008
Hi All,
I am using query analyzer to execute my sqls .
I want to take out .mdf and .LDF files and put it in another machine .
But there is no .mdf or .LDF file with prefix as my database name . I think the file name might be something else .
Please help me in finding out the .mdf and .LDF of a particular database .
Thanks ,
Sushi
View 6 Replies
View Related
Mar 19, 2004
I need a querry to get all columns names.
thanks
View 4 Replies
View Related