Required Day As String; Ex: Sunday

Aug 1, 2006

Hi

I have a string which contains the year and month, now i wanted to know what is the starting day of that month in that particular year.

For Ex: string STR = "Jan2006" then by any chance i can know the starting day of this month as whether it is Sunday etc. I need the string "sunday" as output. Also, I need to know how many number of days that particular month contains. Any function or stored procedure which will give out these two outputs will be much appreciated.



Thanks!

Santhosh

View 3 Replies


ADVERTISEMENT

Transact SQL :: Print Sunday Of Sunday To Saturday Week

Oct 22, 2015

I would like the following code to display Sunday of the Week Sunday to Saturday.

print DATEADD(WEEK, DATEDIFF(WEEK, 0, '2015-10-18'), 0)

If I input a date between '2015-10-18' and '2015-10-24' I would like to print '2015-10-18 as well

View 3 Replies View Related

Monday To Sunday - No Data For A Sunday Being Displayed

Sep 15, 2013

I have written a piece of SQL which I thought was wokring fine. I wanted to show all data for the current week from Monday - Sunday

I wanted to pick up all data from Monday 00:00:01 to Sunday 23:59:59 and then when the data runs again on the next Monday, a completley new set of data starts to be loaded in

On the off chance I have come into work today and realise that no data is being diaplyed, and today is a Sunday

I know for a fact that my SQL will pick up data as soon as it hits 00:00:01 tonight

I really want my SQL to pick up data for a Sunday

BETWEEN DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0) AND DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 6)

View 1 Replies View Related

How To Get First Sunday Of APRIL And Last Sunday

Mar 9, 2006

I have time in the Integer Field ( The Field Represents milliseconds Past Midnight w.r.t GMT )
I want to have a function so that I can pass this integer field to the function and get the DATETIME Value.

In that function I want to code it for Day light Saving time also

How to get First Sunday of APRIL
and Last Sunday of OCTOBER

Eg

ms past midnight w.r.t 47602656
SELECT 47602656 , DATEADD(hh , -5 , DATEADD(MS, 47602656 , CONVERT(VARCHAR(10), GETDATE(), 101)) )

Thx
Venu

View 1 Replies View Related

Connection String Required To Connect Asp.net And Sql Server 7.0

Nov 15, 2007



Hi
I am new to .net and sql server....i have just installed VS 2005 and sql server7.0...
I am doing my coding in vb.net......so i wanted to know the connection of the datagrid to the db in my sql server 7.0.
Can some one pls help me with this urgently.

View 6 Replies View Related

Help Required For Splitting Up String Variable Using Comma Separator

Jul 9, 2007

I need a help in SQL Server 2000.
I am having a string variable in the format like -- (1,23,445,5,12)
I need to take single value at a time (like 1 for 1st, 23 for 2nd and so on) from the variable and update the database accordingly. This is like a FOR loop.
Can anyone help me out in splitting the variable using the comma separator...

View 4 Replies View Related

How To Get First Sunday Of June

Nov 20, 2013

How to get first sunday of june dynamically?

using getdate()

View 3 Replies View Related

Finding Sunday Of A Certain Week

Mar 28, 2002

Hi Guys,
Can you please help me on how to find the sunday's date of a certain week?
Eg: I want to find the date of the sunday of certain week.

View 1 Replies View Related

How To Find Out No Of Sunday In A Month

Apr 30, 2008

Hi,
i am using sql server 2005.
i want to know how to find no of sunday in a month(in any month)

Thank you.

View 2 Replies View Related

Finding Second Sunday Of March

Mar 26, 2007

I want to find the date of second sunday of March 2007 to March 2015 (For daylight saving rule).Is there any function in SQL Server which will retrun that?
Thanks.
I want following..

declare @year int
select @year = 2007
select fn_findSecondMonday(@year)
_________________________________
03/11/2007 -- second sunday of March

Sanjeev Shrestha
12/17/1971

View 8 Replies View Related

Get Last Monday Through Sunday Data Question

Jan 12, 2007

I'm using VB.Net and SQL Server. Here's the scenario I have that I can't figure out how to accomplish:
(btw, this is all manual - I'm NOT using an ASP.Net Calendar control) I want to provide a week's worth of calendar data automatically. Let's say I have all the calendar dates and times in a table. But - I only want to show the data from the current week.
So, no matter which day the end user loads the page (Monday, Tuesday, Saturday, etc), I want to be able to find the previous Sunday (or Monday?), and then provide data from the table for events that are happening from that Monday, through the next Sunday.
Finding the last Monday (or Sunday?) is the first problem, and then getting only data between that date and the following Sunday is the second problem - how to create the code and hw to create the sql statement - -
any ideas?

View 8 Replies View Related

Query To Show Time Monday To Sunday?

Jul 17, 2014

I would like to show employee work hours daily from Monday to Sunday. I have managed to write a query to get the total hours.

This is the query giving total hours from and to date.

(select sum(t.timespent)/60 from timeitems t
where t.employee = e.code
and t.project = p.code
and t.ndate >= '2014-07-15'
AND t.ndate <= '2014-07-15') as Hours
from projemplink pl

View 1 Replies View Related

Returning Up To Previous Sunday Relative To Today

Apr 18, 2008

I'm quite a newbie with MDX.

I have a report that uses MDX to return Figures by day. The user selects the Month/Year eg.[Nov F2007] that he wants to see the figures for.

Here is the catch:

The user wants the figures to cut off to the previous Sunday. So if its Thursday, the result set will still only return results to Sunday.

What I'm thinking is something like this:

STRTOMEMBER('[Nov F2007]').FirstChild : STRTOMEMBER('[Nov F2007]').[LastSunday].

I'm not sure if I'm on the right track, but its a mute point if I can't get the previous sunday as a normal day member (ie. 4 November 2007)



Thanks,
Jason

View 3 Replies View Related

Transact SQL :: How To Generate Week Ranges From Monday To Sunday

May 28, 2015

I need to generate the week ranges like this format :

Here from date and to date would be picked up from the table but just to make you understand i have hard coded it but this is the real date which is falling inside the table. 

Note : Week should be generated from Monday to Sunday within desired date range

View 6 Replies View Related

Reporting Services :: Default Previous Week Sunday

Aug 1, 2015

Is it possible to show previous week Sunday date as default in Date Parameter in Reports.

View 2 Replies View Related

How To Get Starting Datetime(monday) Of The Week And Ending Datetime Of The Week(sunday)

May 2, 2007

hi friends,



how to get the date of the first/last day of the week in sql...

can any one help me





Cheers,

raj

View 5 Replies View Related

Sql Help Required

Jun 27, 2007

 I need to create either a sql query or a procedure and i am not sure how to go about it.Simply i have two fields in a table. 1 for products values and 1 for how many of that product was purchased.What i am wondering is how to calculate this in a sql query.can someone help pleaseIlan

View 5 Replies View Related

HELP Required

Aug 27, 2007

I am deleting a database but I am not seeing any entry in server logs or in event viewer. and same thing is happens when I am deatching a database.Can any body tell me the way through which I can know when a particualr database was deleted or deatched.

View 2 Replies View Related

Help Required

Mar 30, 2004

Psting For Charan,

Hi,

I am trying to connect MS SQL 2000 with C language using ODBC drivers in win 2k environment

i have a UTF 8 string stored in a nvarchar field of the MS SQL table and i am trying to retrieve this field from C and store it in a txt file
everythin is working perfectly fine the probs is that the UTF 8 string is not getting being retrieved correctly

Help Required Urgently

Tks in Adv
Ssg

View 1 Replies View Related

Help Required

Oct 26, 2007

Hello All,
When I execute my SP it throws an error.

Could not allocate space for object '(SYSTEM table id: -449020546)' in database 'TEMPDB' because the 'DEFAULT' filegroup is full.

Any help is apperciated.

Nirene

View 2 Replies View Related

Help Required

Dec 5, 2007

Hello All,
I have 2 tables Trans & Slmast
In Trans
Tran_type,Tran_amt,Slcode
----------------------------
VES,10000.00,AB01
DBN,20000.00,AB01
CRN,30000.00,AB01
BRT,40000.00,AB01
DBN,10000.00,AB02
CRN,50000.00,AB02
BRT,20000.00,AB03
CRN,30000.00,AB03


In Slmast
Slcode,Sldesc
--------------
AB01,ABC Ltd
AB02,CAB Ltd
AB03,BAC Ltd

All transaction related datas will be in Trans for which Slmast is the master.
I want to sum those records based on slcode,tran_type for slcode which does not have tran_type with 'VES'

Sample Output
Slcode,Sldesc,DBN,CRN,BRT
AB02,CAB Ltd,10000,50000,0
AB03,BAC Ltd,0,30000,20000

View 7 Replies View Related

Help Required

Jan 2, 2008

CREATE PROCEDURE VEHICLE_OUTSTANDING @SDt Varchar(10),@EDt Varchar(10),@Cocode Varchar(5),@Brcode Varchar(5),@Loccode Varchar(5),@GLCode Varchar(6)
AS

Select (Loccode+Glcode+Slcode) as LGS,Refno,Refdt Into #VST from Trans_Transnarr
Where Trtype='VES' and (Refdt>=Convert(Datetime,@SDt,103) and
Refdt<=Convert(Datetime,@EDt,103))
and (Cancflg Is Null or Cancflg='R') and Loccode=@Loccode and Glcode=@Glcode

Select Sl.Sldesc,Tr.Loccode,Tr.Glcode,Tr.Slcode,
X.Refno,Convert(Varchar,X.Refdt,103) as Refdt,
Sum(Case When Tr.Trtype='VES' Then Tr.Tramt Else 0 End) as VES,
Sum(Case When Tr.Trtype='DBN' Then Tr.Tramt Else 0 End) as DBN,
Sum(Case When (Tr.Trtype='CPM' or Tr.Trtype='BPM') Then Tr.Tramt Else 0 End) as Refund,
Sum(Case When (Tr.Trtype='JNL' and Tr.Drcrflag='D') Then Tr.Tramt Else 0 End) as JNLD,
Sum(Case When Tr.Trtype='SPS' Then Tr.Tramt Else 0 End) as SPS,
Sum(Case When (Tr.Trtype='CRT' or Tr.Trtype='BRT') Then Tr.Tramt Else 0 End) as Receipt,
Sum(Case When Tr.Trtype='ADV' Then Tr.Tramt Else 0 End) as ADV,
Sum(Case When Tr.Trtype='CRN' Then Tr.Tramt Else 0 End) as CRN,
Sum(Case When (Tr.Trtype='JNL' and Tr.Drcrflag='C') Then Tr.Tramt Else 0 End) as JNLC,
Sum(Case When Tr.Trtype='SRT' Then Tr.Tramt Else 0 End) as SRT
Into #VOS from Trans_Journal Tr,Slmast Sl,#VST X
Where (Sl.Loccode=@Loccode and Tr.Glcode=Sl.Glcode and Tr.Slcode=Sl.Slcode) and
(Tr.Loccode+Tr.Glcode+Tr.Slcode)=X.LGS and (Tr.Cancflg Is Null or Tr.Cancflg='R')
Group By Tr.Loccode,Tr.Glcode,Tr.Slcode,Sl.Sldesc,X.Refno,X.Refdt

ALTER TABLE #VOS ADD OPDR Float,OPCR Float

UPDATE #VOS SET #VOS.OPDR = S.DRAMT,#VOS.OPCR = S.CRAMT FROM #VOS,
(SELECT GLCODE,SLCODE,
(CASE WHEN DRCRFLAG = 'D' THEN OPBAL ELSE 0 END) AS DRAMT,(CASE WHEN DRCRFLAG = 'C' THEN OPBAL ELSE 0 END) AS CRAMT
FROM OBDATA WHERE LOCCODE=@Loccode and GLCODE =@Glcode) S
WHERE #VOS.GLCODE = S.GLCODE AND #VOS.SLCODE = S.SLCODE

Not able to Update OPDR & OPCR

Error Message is
Invalid column name 'OPDR'.

Regards

Nirene Veshnav

View 1 Replies View Related

Are These DB's Required??

Sep 6, 2006

Always wondered, now I have the time to ask - we currently backup ALLdatabases and these seem to all grow in size, the MSDB BAK files are now35mb each and growing!!! Can we remove these from our Enterprise Manager?- Master- Model- MSDBCheers, @sh

View 10 Replies View Related

Help Required!

Feb 28, 2007

Hi allI am creating a web services application in Visual Studio Dot netwhich links to a MS SQL database.I need to create a form which lets the user pick his field ofchoice(doesnt matter what it is..) using drop down boxes,radio buttonsetc and query the database according to what he has picked andretrieve only those columns and rows.The thing is, I do not want to hardcode the queries usingOleDbDataAdapter or SqlDataAdapter, but want the query to be generatedon the fly, once the user picks his fields from the form.I'd greatly appreciate any help.Thanks,m

View 3 Replies View Related

Required Help

Nov 16, 2006

Pl tell me this senario

if we create new database in sql 2000 with size 1024 KB now we insert 500 KB data in that database. so what is actual size of database now?????????

View 3 Replies View Related

Required Help

Nov 3, 2006

Hi,

how we use syscolumns in Sql Server 2005 (Its not work in Sql Server 2005)

View 1 Replies View Related

SQL Server 2008 :: Search Each And Every String In Comma Delimited String Input (AND Condition)

Mar 10, 2015

I have a scenario where in I need to use a comma delimited string as input. And search the tables with each and every string in the comma delimited string.

Example:
DECLARE @StrInput NVARCHAR(2000) = '.NET,Java, Python'

SELECT * FROM TABLE WHERE titleName = '.NET' AND titleName='java' AND titleName = 'Python'

As shown in the example above I need to take the comma delimited string as input and search each individual string like in the select statement.

View 3 Replies View Related

Help Required In ASP.NET Code

Jul 26, 2006

I am writting a very simple ASP.NET code, I am simlply trying to
establish a connection with the database in SQL Server 2000 and than
closing the connection but still I am getting an exception,the name of
the database is mydatabase, SQL Server 2000 is running in the windows
authenticationfiltered=SSPI. The name of SQL Server 2000 running
onfiltered=xyz,
I checked the name from SQL Server Service Manager.Also I would like to
state here that I also tryed to establish a connection using C# and the
connection was successfully establish which means that there is no
problem with SQL Server also I sucessfully established the connection
with MS Access and my ASP.NET application which proves that there is no
problem with IIS also.Also please check that the connection string
which I am providing is correct or not.The exception which I am getting
is as follows:
///////////////////////////////////////////////////////////////////////////////
An exception occured while establishing connection
Login failed for user 'xyzASPNET'.
////////////////////////////////////////////////////////////////////////////
Please also note that I have a user with the name xyz/Administrator in
the logins of Sql Server 2000. Also note one more thing that the name
of my PC is xyz, I think that there is some problem with the connection
string which i am providing so please especially check the connection
string that either I have missed some thing or some thing has gone
wrong,also please tell that are there any security restructions for
ASP.NET to access SQL Server 2000 or some thing like that which I have
to remove.The code is as follows:
//////////////////////////////////////////////////////////////////////////////////////
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

void Page_Load(Object sender , EventArgs e)
{
try
{
SqlConfiltered=new SqlConnection("server=xyz;Integrated Security=SSPI;database=mydatabase;");
connection.Open();
Response.Write("<b>Connection is successfully established</b>");
connection.Close();
}
catch(Exception ex)
{
Response.Write("<b>An exception occured while establishing connection</b><br>"+" "+ex.Message.ToString());
}
}
</Script>

The same above code is also present in the attachement file data.aspx ,
please guide me where I am making mistake and please tell me that how
can I correct this mistake so that the code executes correctly.Also
please tell that what things should be included in the connection
string and also please check the connection string of this code.

View 1 Replies View Related

Replication Help Required !!!

Feb 8, 2002

Hello Friends...

Need your help !!
I have a database say for e.g Test_db . I have data in the form of Image and text in the database . The image data or symbols corresponds to the right text data . This database is being replicated to other servers . The servers are SQL Server 7.0 with SP 3 .

But when this database is replicated , the subscriber does not get the data in the right form . The image and text fields do not correspond properly as it is on the publisher . But sometimes it works .

This is a strange problem and i could not make out what could be the exact problem .
Does any body have insight of this problem pl .
Any kind of help will be appreciated .

Many thanks in advance .
Yatin.

View 2 Replies View Related

RAM Required Per SQL Connection

May 2, 2001

How much RAM is necessary for concurrent SQL connections? My server has 2 Xeon processors, 1GB RAM, a 10GB database size on a TCP/IP box. CPU utilization can run 80-90% and pages/sec can sometimes jump up to 40, especially is the users are running reports from the SQL database. I've been told by some people that I have enough RAM to support the 130 SQL user connections. Others I've been told that I need at least 40MB RAM per user (which means that I'm about 4GB short of RAM). Based on previous entries, I obviously need more, but how much more is the question.

View 3 Replies View Related

Immediate IF ALTERNATIVE REQUIRED

May 14, 2001

Hi!

I wrote a query in MS-ACCESS using IIF. Is there any way to convert it to SQL Server Query to do the same job as it do in MS-ACCEESS

e.g. Here is manipulation with one column that I did in MS-ACCESS

IIf(InStr(1,Destinations.[Destination Name],"-",1)-1<0,Destinations.[Destination Name],Left(Destinations.[Destination Name],InStr(1,Destinations.[Destination Name],"-",1)-1)) AS COUNTRY,

View 1 Replies View Related

SQL Query Required

Mar 23, 2000

I have a table

Table1
------

StudentId Class Test1 Marks1 Test2 Marks2 Test3 Marks3
---------------------------------------------------------------------------
1 1 1 50 3 35 5 40
2 1 1 50 4 40 7 43
3 2 1 47 3 50 6 42


I would like to Insert this data into another table in this form

Table2
------

StudentId Test Marks
---------------------------
1 1 50
1 3 35
1 5 40
2 1 50
2 4 40
2 7 43
3 1 47
3 3 50
3 6 42


Can you write a SQL Query to accomplish this.

Thank you

View 1 Replies View Related

Required....help....URGENT

Mar 15, 2000

Hi,
I have a doubt.....
I have a text field that is 255 bytes in lenght and I want the contents of this full field to be split.....on various gouds which may be ',' or and or 'And' etc

This field stores all the skills...

So i have created a search module ....but this search is taking awfully long as u know text field searches are tedious...

Can u please suggest a way I could parse/split the text field to enable faster search....

Newbie

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved