I have SSRS 2005 SP2 configured to work in Sharepoint integration. Everything works fine except that I am not able to programmatically change any property of report viewer web part (instance) that I have added on on home page of my sharepoint site. I can do same thing via sharepoint UI but not through program. When my programs runs it fetches all web parts been added on home page, then I need to iterate through each one and find report viewer web part. While iterating, as soon as I arrive to report viewer web part it is named as "Error web part" with error message as "Windows SharePoint Services cannot deserialize the Web Part. Check the format of the properties and try again"
If someone has a solution, please respond at your earlist.
I have a table with a column named measurement decimal(18,1). If the value is 2.0, I want the stored proc to return 2 but if the value is 2.5 I want the stored proc to return 2.5. So if the value after the decimal point is 0, I only want the stored proc to return the integer portion. Is there a sql function that I can use to determine what the fraction part of the decimal value is? In c#, I can use dr["measurement "].ToString().Split(".".ToCharArray())[1] to see what the value after the decimal is.
I have a datetime field in a sql db named "arrdate". For what I am doing I only need to extract the date formatted as mm/dd/yyyy. Can someone give me an example of the proper syntax? Something like seems like it should work: SELECT id, DATEPART(mm/dd/yyyy, arrdate) FROM guest but of course it doesn't.....
SET NOCOUNT ON DECLARE @PROG1VARCHAR (20), @PROG2VARCHAR (20); --@PROG_YR VARCHAR (2);
SET @PROG1 = 'TRAK08' SET @PROG2 = 'TRAK208' SET @PROG_YR = Select DatePart(YY, GetDate()) as Current_Year
SELECT @Rpt_Yr = case @Frequency WHEN 'M' then (select dateadd(mm,datediff(mm,0,getdate())-1,0)) WHEN 'O' then convert(varchar,@Start_Date,101) + ' 00:00:00' ELSE convert(varchar,getdate()-1,101) end -------------------------------------------------------------------------------------------------- I have done most ot the script for the rest of my pgoram but I am having problems with the date requirements. I was told to parse the year so that the user can enter the 2 digit date.
When it is 'O' (other) was told build a string to parse the year using datepart so that the user can enter the program year (2 digit format). (@Rpt_Yr) When it is 'M' (monthly) then I am to goto to table tk_prog get the active program I have no clue how to correct the above.
i'm trying to format SQL so that I retrive the day of the week and the hr in the same column.
SELECT Datepart([hour], Time) as Hour, SUM(Total) as Sales, count(TransactionNumber) as Customers, SUM(Total)/count(TransactionNumber) as 'Ave Sale' FROM [transaction] WHERE time between '05/30/2008' and '05/31/08' GROUP BY datepart([hour],Time)
Hi , I am converting a datetime field to a string. The column is called DateScanDate.
This is my query;
SELECT CAST(DATEPART(Year, DateScanDate) AS VARCHAR(4)) + CAST(DATEPART(Month, DateScanDate) AS VARCHAR(2))+ CAST(DATEPART(Day, DateScanDate) AS VARCHAR(2))+ CAST(DATEPART(Hour, DateScanDate) AS VARCHAR(2))+ CAST(DATEPART(Minute, DateScanDate) AS VARCHAR(2))FROM HAAneurysmScan
I would like the month of March to be '03' instead of '3' and the 9th day of the month to be '09' instead of '9' How can I do this? regards ICW
I would like to take the following code and display the data / count by month. I want to see how many people are logging in by month.. I tried using the datepart but I keep getting an aggrefate comannd error can anyone help modify this query
SELECT DISTINCT Count(login.login_time) AS CountOflogin_time FROM login WHERE login.login_time>=#10/1/2005#;
Hi everyone, Im currently using SSRS 2000. I have a report that pulls data since 2001. I used Datepart('m", Fields!Shipped_Date.Value) to break it down into months. It works except that it doesnt separate the year. It'll group all of january together but 2001,2002,2003, etc, together. Then when I used Y to break it down by year, it does break it by year but keeps all the months together.....well what I want is to be able to have it jan 2001, feb 2001, jan 2002, separately group. Hope I didnt confuse anyone. All pointers welcomed.
I'm trying to get just the day part of the date - 2/22/2005 (getdate()) but instead of returning '22', it's returning '2'. Can someone please tell me what I'm doing wrong?
Thanks! Lynnette
Here's the code
declare @thisDay varchar set @thisDay = Convert(varchar, Datepart(day, getdate()))
Hello dears; I wanted to use DatePart function in an SQL statement using objectDataSource to extract the year only from a Date field, then populating only the years in Dropdown list, but it didn't worked. Is is possible to to use that function in an SQL statment.? Thanks alot VWD 2005
The first one needs to be the Date part, the second one needs to be the Time part. Anyone know who to do this? I saw DATEPART in SQL BOL but it didn't really show me.
We are looking on how to do a between statement for comparing only month and days(such as birthday.) The proc will be fed 2 parameters and we want to check if a date field (only the month and day) fall between the parameters. Such as the parms are 09/01/2000 and 10/31/2000 I want to return all records where the date field is between 09/01/xxxx and 10/31/xxxx. I tried the datepart function but couldn't find a way to combine them. Any solution greatly appreciated.
Will someone please tell me how to pull the time out of a smalldatetime field. The code i am trying to use is as follows:
Select datepart(hh:mm, TimeField1) from table1;
This gives me an error. I have also tried datepart('hh:mm'... datepart("hh:mm"... and other variations but i cant get anything to work. Thanks in advance for any help!!
returns 5 on one SQLServer, and 4 on another one. It cannot be a regional settings problem because 25 could never be a month. Any way, is there a deterministic way to create a DATE regardless of the server's regional settings?
I mean, I have the year, month and day... how do I tell the server "This is the year; This is the month; This is the day... convert this into a DATE, and the tell me which day of the week is"??
Hi, everyone! Could anyone help me with understanding of the datepart() function. I want to retrive data from a database that was added in this week, starting from Sunday. Suppose today is Tuesday, so I want to get all the records that were added on Sunday, Monday, and Tuesday. Can I use ... where datepart(wk, Date_Reported)=datepart(wk, getdate()) ? Thank you.
INSERT INTO [IMPAPT].[dbo].[YearMaster] ([yearID] ,[year] ,[IsActive] ,[creationDate]) VALUES (1 ,datepart(yy,getdate()) --------line need to be discuused ,1 ,getdate()) the output result is yearID Year IsActive creationDate 17/2/1905 12:00:00 AMTrue 6/11/2008 1:21:17 PM
But when i write query
select datepart(yy,getdate() As Year it throws result : 2008 Why this is not happenin in the insert query
I have a function that uses the following statement in it
SELECT src_terrier.Areacode, src_terrier.siteref, src_terrier.estatename, src_terrier.Securitised, src_terrier.unitref, src_terrier.unittype, src_terrier.unittype_count, src_terrier.tenantname, src_terrier.tenantstatus, src_terrier.tenantstatus_count, src_terrier.unitstatus, src_terrier.unitstatus_count, src_terrier.floortotal, src_terrier.floortotocc, src_terrier.initialvacarea, src_terrier.initialvacnet, src_terrier.TotalRent, src_terrier.NetRent, src_terrier.FinalRtLsincSC, src_terrier.ErvTot, src_terrier.tenancyterm, src_terrier.landact, src_terrier.datadate, src_div_mgr.div_mgr, src_portfolio_mgr.portfolio_mgr, src_centre_list.propcat, src_tbl_rental.budgeted_net_rent, src_tbl_rental.budgeted_occupancy FROM src_terrier INNER JOIN src_centre_list ON src_terrier.siteref = src_centre_list.Site_Ref AND src_terrier.Areacode = src_centre_list.Division INNER JOIN src_div_mgr ON src_centre_list.Division = src_div_mgr.division INNER JOIN src_portfolio_mgr ON src_centre_list.Portfolio_no = src_portfolio_mgr.portfolio_no LEFT OUTER JOIN src_tbl_rental ON src_terrier.siteref = src_tbl_rental.site_ref
WHERE (src_terrier.datadate = @dt_src_date) AND (src_terrier.Areacode = @chr_div) AND (src_centre_list.Portfolio_no = @vch_portfolio_no) AND (src_centre_list.propcat = @vch_prop_cat) AND (src_tbl_rental.site_ref = src_terrier.siteref)
The problem I have is that the 'src_terrier.datadate' is passed through as mm/dd/yyyy (which I do actually want to change to dd/mm/yyyy as that is how the data is stored) however, the src_date within the table src_tbl_rental is only set to 01/mm/yyyy. When I put an inner join on the date element it obviously does not find it as the sample data I am using is as follows
src_terrier = 28/04/2006 and src_tbl_rental is 01/04/2006. Therefore if I pass the same parameter value through the dates are not the same and I get no data at all.
How can I specify that for the purposes of the src_tbl_rental element of the select query, that I only want it to match the mm/yyyy part of the src_date.
Therefore if some passes in 28/04.2006 it will get the records from the terrier table that match that date, and only the records from rental that match the 04/2006 part of the date.
Hi - Can anyone tell me what the first day of the week (i.e. equal to 1) for the DATEPART("dw",<date>) expression in SSIS. Or can I specify the first day of the week somehow?
It looks like Monday=1 which seems a little odd as the equivilent T-SQL DATEPART has Sunday=1.
If I execute "SELECT DATEPART(weekday, '20080330') as day_of_week", I get a result of 1 which makes sense since Sunday is usually considered the 1st day of the week.
However, if I execute "SELECT DATENAME(weekday, DATEPART(weekday, '20080330')" as day_of_week, I get a result of Tuesday!
Similarly, if I execute "SELECT DATENAME(weekday, 1) as day_of_week", I also get a result of Tuesday.
I have a chart that displays the number of downloads by product by week by year. I am using sql to group by DATEPART(WK, DownloadDate) and DATEPART(YY, DownloadDate). This however shows the week number (ex: this week is 49) on the x axis. I would like to show the tick marks as the Sunday and Month of that week. Example: 12/3. The year is shown under these so that part is fine. Any ideas how I might accomplish this?
The purpose of the code below is to produce graphs in a report (thus the SELECT DATEPART so the month and year appear on the graphs using COUNT in the report.) I have two challenges:
1. How should the code be modified so that it returns the previous two months at the start of a new year? (I.e. In Jan. 2008, returning Nov. & Dec. 2007, and in Feb. 2008, returning Dec. 2007 & Jan 2008, etc.) 2. How should the code be modified so that the DatePart and DateName data are treated as dates yet still appear as the Month Name and Year (June 2007)? Currently it is treating them as alphanumeric so that on the chart, July is coming before June. Thank you.
SELECT DISTINCT TBL_01.id, TBL_01.url, TBL_01.source, Tbl_02.type, TBL_01.time, Tbl_03.time, DATENAME(month, TBL_01.time) + ' ' + DATENAME(year,TBL_01.time) as Month_Year FROM Tbl_03 INNER JOIN Tbl_04 ON Tbl_03.id = Tbl_04.endsTBL_01 LEFT OUTER JOIN Tbl_02 ON Tbl_04.endsTBL_01 = Tbl_02.id LEFT OUTER JOIN Tbl_05 ON Tbl_04.ursid = Tbl_05.SubId INNER JOIN Tbl_03 AS TBL_01 ON TBL_01.id = Tbl_04. EFP WHERE (Tbl_04. EFP IS NOT NULL) AND (Tbl_05.grade IS NULL OR Tbl_05.grade = 'NC') AND (DATEPART(month, TBL_01.time) < (SELECT DATEPART(month, getutcdate())) AND DATEPART(month, TBL_01.time) > (SELECT DATEPART(month, getutcdate()))-3 AND DATEPART(year, TBL_01.time) = (SELECT DATEPART(year, getutcdate())) AND (Tbl_02.type IS NULL OR Tbl_02.type = 'CC' OR Tbl_02.type = 'MK')) ORDER BY Tbl_02.Type, Tbl_03.time DESC