Associates A1 0 80 ......
Assocaites A2 20 40 ......
Associates A3 50 100 ......
Principal P1 20 100 ......
Principal P2 0 0 ......
Principal P3 0 100 ......
------------------------
I want to change the above to something like below table2:
---------------------------
GroupName Status Week1 Week2 ....cont
Associates Assigned 2 3
Associates NotAssigned 1 0
Principal Assigned 1 1
Principal NotAssigned 2 1
---------------------------
I will try to explain how I am deriving table2 from table1. I have to count the number of Resource name against each Groupname for a particular week column(Weeki i 1 to n dynamic) where value of Week column is 0, then use this numbber against NotAssigned and the complementary number to be stored as Assigned.
The table formaating is lost in HTML view but just consider any gaps between fields as next column value.
Am I clear in what i am asking , if not please ask me.
Query: Select convert(CHAR(45),surname+','+fname) Name from beneficiary Output from the above query: Name --------------------------------------------- BICKFORD ,ROSA KOCH ,ERIC
I am desired Results as follows: Please help Name --------------- BICKFORD,ROSA KOCH,ERIC
Hello,I have a problem the scenario is :I have data in an excel file and now I am reading data from that file and insert that data into sql database. this is well.but the problem is that I have few fields with date time data in excel sheet. In my database I have varchar type data type for these data columns.I want to read these data columns from the excel sheet and insert only time into the data base.how can I do this I am using the following line of code for selelcting only time from the excel file. string qry = "Select CONVERT(CHAR(5),datetime,114) from [" + objStr[0] + "];";this gives me error message.help me to read the data from excel file and insert it into the sql table in desired format. Thanks in advance, junior
I have to display the data in the below said formats..Current sample Data in the table and the data type is numeric(23,10)
50.00 0.50 0.00 0.00
To be displayed in the below format
1.25 0.75 0 0 1
I have to map this column in teh report and should dipslay like above.I think if 0.00 is available then it should display as 0..If 1.0 is available then it should display 1.Any value that has postive number after the decimal should display all the values example : 2.25,3.75,5.06, So in general the solution to display values like 1.75,1,0 we should not dispaly 0 as 0.00 and 1 as 1.00 and 2 as 2.00 and so on...Any Solutions in terms of SQL query or SSRS expression.
The query below, as it stands, does a search for strings like 'Fema', that exist in the word 'Female', and returns 'female'. Now, if the word 'Acc' stands on it's own, I want to know how to return it as 'Accessories' in the result set. And yes, I've tried the obvious (When 'Acc' Then 'Accessories') but that returns a Null instead of 'Accessories'!!
Here's the query:
SELECT CategoryID, Category, CASE substring(category, 1, 4)
when 'fema' then 'female' WHEN 'Male' THEN 'Male' WHEN 'Gift' THEN 'Female' END AS CategoryGroup
I have a query that I am trying to run, but I discovered I am not getting the desired results.
This query here goes across the tables as seen below. One thing that I notice about this query as I am trying to figure out the source of the problem is that it is bringing back the same results even when I change the @userID parameter.
As long as the @userID I pass exists in "tblUserDetails" then we get results back. When it doesnt exist we dont get any records.
Basically to explain whats going on. I am passing the userID of the person who has "photocomments"
Since the table "tblPhotoComments" doesnt have a column that represents who the photocomment was for, we must join
CREATE TABLE [dbo].[tblExtraPhotos]( [counterID] [int] IDENTITY(1,1) NOT NULL, [photoID] [tinyint] NOT NULL, [userID] [int] NOT NULL, [photoDate] [smalldatetime] NOT NULL, [caption] [varchar](50) NULL, [status] [tinyint] NOT NULL
GO
CREATE TABLE [dbo].[tblPhotoComments]( [photoCommentID] [int] IDENTITY(1,1) NOT NULL, [photoCounterID] [int] NOT NULL, [CommentFromID] [int] NOT NULL, [Comment] [varchar](1000) NOT NULL, [commentDate] [smalldatetime] NOT NULL, [Active] [tinyint] NOT NULL, [deletedbySender] [tinyint] NOT NULL, [deletedbyRecipient] [int] NOT NULL, [IP] [varchar](15) NOT NULL ) ON [PRIMARY]
When I do a select on a date field, the date in 6.5 was displayed as- Jan 1 1999 12:05AM
In 7.0 it is displayed as- 1999-01-01 00:05:00.000
Can anyone please shed some light on this? ie. why is there this difference? Also can this display format be controlled (by server language used or regional date setting)?
Hi!I'm wondering is there any simple way to achieve the followingfunction call in SQL Server. The sentence to translate is (Oraclesyntax):to_char(rownum, '000')rownum: number of the current rowto_char: formats a number (the 1st param) according to the formatdefined in the 2nd param. In this case, the '000' preprends 2 or morezeros until forming a 3-digit number.I'm using it in something like:SELECT id_table, string_column || TO_CHAR(ROWNUM,'000') FROM tableThanx a bunch,Cro
Hi, I am using a sql database and vb.net... In form i display a date from calendar as smalldatetime in the format of dd/MM/yyyy by changing the web.config file to culture = "en-GB"... It did display as dd/MM/yyyy with no doubt... Problem is in sql database it is display as mm/dd/yyyy, there4 when i retrieve it out, it is not the format i wan... so can any1 helps mi? I need do many adding and subtracting to the date so a constant dd/MM/yyyy format is veri important to mi... I cant save it as yyyy/mm/dd cos my boss dun wan it... If use Convert method when i select * out how to convert the date zzz Helps would be greatly appreciated
Is it possile to definea custom format for the 'display format' property of a measure so that the results are shown in Thousands or Millions or Billions e.g
100,000 can be shown either as 100T OR 1,000,000 can beshown as 10M OR 10,000,000 1B
Sorry if I got my numbers wrong but I hope you get the idea?
Hi all I am using local reports.(.rdlc files) My requirement is when the user selects some options in the form and click on Submit buttion,He should get report in PDF format directly.Is it possible?if possible give me some example code.No need to preview in general format. Help me. Regards.
I want a ssrs report with two tables adjacent,using same data set. I want to start row number/records in second table where rownumber of first table ends.and in second page first table should start where second table of first page ends.
I have a requirement to display the elapsed time between two datetime fields. What i have been able to do is datediff the dates and get the elapsed time in minutes and then i am trying to format it as HH:MM.
For example, an activity started on Nov 1 2007 08:00 and finished Nov 1 23:59, the elapsed time should be displayed as 15:59.
The other example is if the activity spans over a couple of days, it should be say 49:03.
I put the following code in the format of the textbox, but it only seems to work when the length of the minutes is greater than 1.
Hi guys n gals ! I am having a few problems manipulating the results of my data reader,To gather the data I need my code is: // database connection SqlConnection dbcon = new SqlConnection(ConfigurationManager.AppSettings["dbcon"]); // sql statement to select latest news item and get the posters name SqlCommand rs = new SqlCommand("select * from tblnews as news left join tblmembers as members ON news.news_posted_by = members.member_idno order by news.news_idno desc", dbcon); // open connection dbcon.Open(); // execute SqlDataReader dr = rs.ExecuteReader(); // send the data to the repeater repeater_LatestNews.DataSource = dr; repeater_LatestNews.DataBind(); Then I am using: <%#DataBinder.Eval(Container.DataItem, "news_comments")%> in my repeater.What I need to do is pass the "news_comments" item to a function I created which will then write the result. The code for my function is: // prevent html public string StripHtml(string data) { // grab the data string theData = data; // replace < with &alt; theData = Regex.Replace(theData, "<", "<"); // return result return theData; } But I am having problms in doing this,Can anyone point me in the right direction on what I should be doing ???
insert into Test123 values(1,'Name','X') insert into Test123 values(1,'Age',50) insert into Test123 values(1,'Salary',1000) insert into Test123 values(2,'Name','Y') insert into Test123 values(2,'Age',30) insert into Test123 values(2,'Salary',2000) insert into Test123 values(3,'Name','Z') insert into Test123 values(3,'Age',35) insert into Test123 values(3,'Salary','One Hundred')
And I want output in below format.
AttributeValueType ================= AGE | NUMERIC NAME | ALPHABET SALARY | ALPHANUMERIC ==================
I'm querying a database table that creates a time stamp in seconds only. I have a starting time of 1099725928 = 11/6/2004 12:25:28 AM. So that if another entry is made 1 second later the time stamp value entered into the table is 1099725929. The front end application does the converstion from the seconds counter to the datetime format. The query I am writing calls information from this table for a different application that does not have the conversion capability. If I know the starting point (I don't want to create a conversion table) which is 1099725928 = 11/6/2004 12:25:28 AM, is it possible to write into my query script a function to convert the seconds value to the correct datetime format? It would need to accurately account for leapyear and even/odd months.
************************************************************************************************ Select Case_ID_, Region, Assigned_To_Group_, Assigned_To_Individual_, Status, Priority, Category, Type, Item, Affiliate, Hours_to_resolve, Resolved_Time, Assign_Time, Create_Time From HPD_HelpDesk Where Region = 'Central Valley' and Assigned_To_Group_ = 'CVSA Desktop Support' and Status In (1, 2, 3, 4, 5) and Priority In (0, 1, 2, 3)
Order by Case_ID_ Desc************************************************************************************************
I'm using SSRS to generate reports. i have many columns data to be displayed.while converting the data into Excel and PDF the data, header, and footer are not displaying proper format. what are all the properties to be set for that.
Power pivot graph. I do have different transaction names, dates, count, exec time with me, I need to display each transaction execution day, execution time in graph format. Suppose execution time is on Y axis and Exec time is on X-axis then to display the which transaction takes more time for execution.I have Query just I need to display in graphical format
Hi all, I am using ASP.NET 2003 with SQL Server as database. I have a database of a book store with BookPicture, Author, Title, and Description of the Book. Now when the user searchers for a book with a keyword, how can I display the results which should show: 1. The picture of the book, 2. The at it right, Title of Book, 3. The author,4. The descritionThen the image of "Add to cart" Each search result must be separated by a box like the cell of a table. Is it possible to be done? Thanking you in advance Tomy
i m creating one google map application using asp.net with c# i had done also now that marker ll be shown from database (lat,long)depends on the lat,long i wanna display customer,sales,total sales for each makers in html table format.
Hi All, I am not sure whether this is the right place to post this question. But I am unable to figure out what is the best solution to retrieve and display an image in a html file(stored in varbinary(max) column). I have a list of images in the file and I am supposed to display them. Can anybody please let me know what is the best way to do this? Thanks a lot!!
When I run the following query from Query Analyzer in SQL Serer 2005, I get a message back that says. Command(s) completed successfully. What I really need it to do is to display the results of the query. Does anyone know how to do this? declare @SniierId as uniqueidentifierset @SniierId = '85555560-AD5D-430C-9B97-FB0AC3C7DA1F'declare @SniierAlias as nvarchar(50)declare @AlwaysShowEditButton as bitdeclare @SniierName as nvarchar (128)/* Check access for Sniier */SELECT TOP 1 @SniierName = Sniiers.SniierName, @SniierAlias = Sniiers.SniierAlias, @AlwaysShowEditButton = Sniiers.AlwaysShowEditButtonFROM SniiersWHERE Sniiers.SniierId=@SniierId
I hope I am not asking about something that has been done before, but Ihave searched and cannot find an answer. What I am trying to do is torun a query, and then perform some logic on the rowcount and thenpossibly display the result of the query. I know it can be done withADO, but I need to do it in Query Analyzer. The query looks like this:select Varfrom DBwhere SomeCriteriaif @@Rowcount = 0select 'n/a'else if @@Rowcount = 1select -- this is the part where I need to redisplay the resultfrom the above queryelse if @@Rowcount > 1-- do something elseThe reason that I want to do it without re-running the query is that Iwant to minimize impact on the DB, and the reason that I can't useanother program is that I do not have a develpment environment where Ineed to run the queries. I would select the data into a temp table, butagain, I am concerned about impacting the DB. Any suggestions would begreatly appreciated. I am really hoping there is something as simple as@@resultset, or something to that effect.
Dear Friends, I've created one table, with the following attributes. everything is ok, but while retrieving data, the question numbers should be starting from 1,2.......... but i'm not getting that result. please suggest me to the output like that.
1htmlbeginerwhat is clr?somethingsomethingsomethingsomethingsomething 2c#beginerwhat is clr?somethingsomethingsomethingsomethingsomething 3c#expertwhat is clr?somethingsomethingsomethingsomethingsomething 4c#intermediawhat is clr?somethingsomethingsomethingsomethingsomething 5c#beginerwhat is clr?somethingsomethingsomethingsomethingsomething 6vbbeginerwhat is clr?somethingsomethingsomethingsomethingsomething 7htmlexpertwhat is clr?somethingsomethingsomethingsomethingsomething 8sqlserverintermediawhat is clr?somethingsomethingsomethingsomethingsomething 10oraclebeginerwhat is clr?somethingsomethingsomethingsomethingsomething 11javabeginerwhat is clr?somethingsomethingsomethingsomethingsomething 12javaexpertwhat is clr?somethingsomethingsomethingsomethingsomething 13sqlserverbeginerwhat is clr?somethingsomethingsomethingsomethingsomething
--select * from question_code_level where code='c#' and level='beginer'
2c#beginerwhat is clr?somethingsomethingsomethingsomethingsomething 5c#beginerwhat is clr?somethingsomethingsomethingsomethingsomething
Hello, I am trying to get results in one row from the following function but all records does not come from the following function. I have 9 records of the same empid but results not showing all records. Can anybody help me to get all records.
CREATE FUNCTION dbo.GetBenefString5 ( @Empid INT ) RETURNS VARCHAR(8000) AS BEGIN DECLARE @ret VARCHAR(8000) SELECT @ret = '' SELECT @ret = @ret + CASE WHEN LEN(@ret) > 0 THEN ',' ELSE '' END + FName + ' ' + Benefittype + ' ' + BenefitPercentage From Beneficiary
Where Empid = @Empid RETURN @ret END
SELECT Empid, dbo.GetBenefString5(Empid) FROM pf25eaton_work.dbo.eaton_chr_benef_05052008 where EmployeeNumber='4500498' GROUP BY Empid
Result from the above function query: Empid ----------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1773 CHARLENE OLIF 33 ,CHARLENE EADD 33 ,CHARLENE ELIF 33 ,TIMOTHY EADD 33 ,TIMOTHY
(
Records are in the table: FName Benefittype BenefitPercentage ---------------------------------------- ----------- ----------------- CHARLENE OLIF 33 CHARLENE EADD 33 CHARLENE ELIF 33 TIMOTHY EADD 33 TIMOTHY ELIF 33 BRADLEY ELIF 33 TIMOTHY OLIF 33 BRADLEY OLIF 33 BRADLEY EADD 33