I wrote the query like this
"select datepart(year, Msg_Time) from C20_Messages"
This query result is:-
Here I want to get only the year part without repeating.
I have three types of specific reports that i have to create with the input parameters (range) either
1: By date (rdl 1)
2.By Month (rdl 2)
3.By Year (rdl 3)
Is it possible ( or how do I ) to create just one report template ( one rdl) with the three sets of parameters ( hiding/invisible which ever two sets base on user selection) and the output of the report will display the desired type( either by year, month or date).
I ask this because its possible to create a drill down report from year down to date etc in report designer (vs 2005). Not sure if I can create one instead of three rdls and with the 'logic' built within that template.
I have three web form controls, a ddl that contains the day, another ddl that contains the month and a textbox that contains the current year. To send the date chosen by the user to the database, I join the three web form control values so that the resultant string is ‘day/month/year’ thus:
And the resultant string is: dd/mm/yyyy, for example 30/08/2004. But the problem is if the user does not select any day or any day and month, then the resultant string is for example; 00/08/2004 or 00/00/2004, but the problem is the database does not accept this format as datetime. How can I do it?
I want the user has the possibility to chose as well only the month and year, and as well only the year. Is it possible to send to the database the datetime format with only the month and year, or only the year?
Does anyone have an example of an SQL query which returns rows for theyear-to-date, but where the "year" commences on August 1st?e.g. select * from mytable where datefield > last august 1stTIA for any helpIsabel
hai friends, iam doing a project in .net and using sql server. i need to compare only month and year part in datetime type to retrive data. 1)retrive unique year and its months available in the database. like may 2008 apr 2008 mar 2007
Greetings All, I have a SQL question that maybe someone out there can help me with. Our fiscal year starts on 01/27. I want to write a query that I can pass a date to and it will return the week number (DATEPART("ww", someDate)) of the year using the Fiscal Year Start Date as the base. Datepart works great except it figures the first day of the year as 1/1. Does anyone know how I can make it work with a first day of the year equal to the fiscal year date 01/27. Any help would be appreciated. TIA, ~ck
Hello All, i have three textboxes in a page and i want fill those textboxes with the date, month,year respectively..... i have a datecreated column in discount table in a mm/dd/yy format ...how to extract the date, month, year from this format and put the value in textboxes..? Any help.. Thanks.. Anne
I'm looking for a way of taking a query which returns a set of date time fields (probable maximum of 20 rows) and looping through each value to see if it exists in a separate table.
Select ID, Person, ProposedEvent, DayField, TimeField from MyOptions where person = 'me'
Select Person, ExistingEvent, DayField, TimeField from MyTimetable where person ='me'
Loop through Query 1 and if it finds ANY matching Dayfield AND Timefield in Query/Table 2, return the ProposedEvent (just as a message, the loop could stop there), if no match a message saying all is fine can proceed to process form blah blah.
I'm essentially wanting somebody to select a bunch of events in a form, query 1 then finds all the days and times those events happen and check that none of them exist in the MyTimetable table.
I have a very beginer's question. I am trying to compare datetime field with time only. how can i just compare with time?
Select start_time,end_time from tblvouchers as sv,tblvoucherlines as svl where sv.voucher_no = svl.voucher_no and sv.equip_no = '01325' and svl.line_date ='03/14/2004' and svl.start_time = '18:00' and svl.end_time = '00:00'
How can I display data that only compare the date part (ignoring the time part) between the value of the date parameter and the database?. It displays data only if I pass the whole date (date and time)
I tried with the following query in the report services 2000, but it even didn't pass the query parse
SELECT * FROM table
WHERE (CONVERT(CHAR(8), table.PRODUCTION_DATE, 112) = CONVERT(CHAR(8), @parameterDate, 112))
I'm trying to extract the time part of a smalldatetime field in a usprocedure to return just the time. I've used Datepart() to get the hours or minutes but you can't get both without getting messy. Anyone know a way to keep it neat & simple?
In the hereunder written message I talk about point in time restore.It is now based upon the fact that there are no hardware problems or what soever.I just would like to roll back to a situation of some time (minutes, hoursor what ever) ago.Used to the ingres database a point in time restore can take place UP toany, any, any time since the last FULL backup. (any time up to now !!!)I can't understand why a point in time restore can only be done based upontransaction log backups. The current transaction log is also available in myopinion. (Turn off the power, turn on the power and you will notice that theautomatic recovery is based upon this transaction log file; so in that casethis file is used)That's what my question is about. Is it correct that a point in time restorein a SQL server environment can only be done up to the last transaction logbackup.ByeArno de Jong,The Netherlands.
I use smalldatetime for a datetime and i just display the date part i'd like to compare the date part of the smalldatetime and the date i have how can i do that ? I know we can select the day,month or year ... If you know a link where i could find different kinds of example about sql command it would be great to
We have 2 databases ( Guider and Talker ) and we have a WCF service that is logged in with a domain identity.
In our SQL Server we have the service ID added to the Data Server Logins and both Guider and Talker are given access to the user.
When we access Guider we have no problems getting data.
When we access Talker we have a login failure:
Cannot open database 'Talker' requested by the login. The login failed.
Login failed for user 'AcornCommunicationServices'.
The thing that gets me is that the user is created at the Server level, in both Databases, and at the server level both databases are checked for the user. master has been set as the default database for the user.
Basically, as far as I can see Talker and Guider are configured identically! So I cannot figure out why I cannot login to the second database!
Is there a specific setting I'm missing somewhere to grant login access to the user? I'm using
I think this is a simple question but I am just not sure how to do it right, as a newbie.
All I want to do is generate a report of company employees grouped by their date of hire.
SELECT DateOfHire, FirstName, LastName from Empls ORDER BY DateOfHire
The only problem is that the DateOfHire displays as, e.g., '01/03/2004 12:00:00' which is not what I want. I SIMPLY WANT TO OMIT THE TIME PART but don't know quite how to say this. I tried several variations along this line but it causes scoping errors...
SELECT CONVERT(Varchar(10), DateOfHire, 101) AS DOHDateOnly, FirstName, LastName, State FROM EMPL GROUP BY DOHDateOnly
but this gives error
"The value expressions for the textbox DateOfHire refers to the field DOHDateOnly. Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope."
Which makes sense, but I don't know HOW to say the right thing to get what I want.
I am struggling to calculate Full year in my SSAS Cube. Meaning, regardless of what fiscal year hierarchy level I am in; i need a measure aggregating from 01/01/year of current member to 12/31/year of current member.
I want to replicate it using the Year To Date below:
FY-FQ-FM is the fiscal year quarter hieararchy
I am using for built in time intelligence.
Create Member CurrentCube.[DimTime].[FY-FQ-FM DimTime Calculations].[Year to Date] As "NA"; /*Year to Date*/ ( [DimTime].[FY-FQ-FM DimTime Calculations].[Year to Date],
Ok, so I have a Select statement that looks like this:
Select * from FilteredOpportunity where (OpportunityID LIKE @opportunityid) and (Name LIKE @name) and (CustomerIDName LIKE @customeridname) and isNull(EstimatedCloseDate, '1900-01-01') LIKE @estimatedclosedate and isNull(Description, '') LIKE @description and isNull(AccountIdName, '') LIKE @AccountIDName and isNull(ACCU_OppTypeName, '') LIKE @ACCU_OppTypeName and isNull(SalesStageCodeName, '') LIKE @SalesStageCodeName and isNull(ACCU_CustomerTypeName, '') LIKE @ACCU_CustomerTypeName and (CreatedByName LIKE @CreatedByName) and (CreatedOn LIKE @CreatedOn) and isNull(ACCU_OppSourceName, '') LIKE @ACCU_OppSourceName and (StateCodeName LIKE @StateCodeName) and (StatusCodeName LIKE @StatusCodeName)
This chunk of code is used in an XML file which, once this XML is imported (using sharepoint by the way if you haven't noticed), I can then search through tables with different filters. Well, my date filter isn't working the same way as my other ones. I have a couple different date filters, but none of them work.
Before I ask my question, I only pass in one variable at a time through my code.... the rest of the variables get a default value passed to them if the user doesn't pass it. That value is simply '%'. Anyways, so the different ways a user can type in a date is by typing in the whole date, part of the date starting with the beginning of it, typing in the end of the date, or typing something within the date. For a string it's like 'Example', 'Exam%', '%ple', and '%amp% respectively. How do I accomplish this with a date?