Dear all
i am newbie to this forum as well as learning SQL so don't have much knowledge.
i want one query which will transpose data in column
i have 3 fileds
Scrip--COC--DAte
A--25--01/06/07
B--34--01/06/07
C--65--01/06/07
A--65--02/06/07
B--98--02/06/07
C--37--02/06/07
now this date column will be only 5 i.e. 1 which user puts + 4 preceding dates from user date (ignoring sequence means if user put 10/06/07 then next will be 09/06/07 but if this wont exists then take 08/06/07 & so on till 4 dates)
the data will be unique means no scrip repeats more than once in a day
There is a strange problem on my tables . When i execute a simple query from Query Analyzer, say select * from ' table name' , then i can edit or enter text in my result in one of the columns.
But the same table if i try to open through the Enterprise problem , i.e selecting the table , right click and select open table and then if i select return all rows , it does not allow me to enter text in a specific coloumn .
But the same is possible if i execute a query and try to enter text in the results which is displayed in grid from the Query Analyser .
Could anybody help me to know what could be the problem and how can i enter a text it ?
Is there a way to get markers on the top of each graph of a stacked column chart? Also i need to display a label when the mouse points over each of the marker, as well as each partition of the graph. Getting the tooltips to work might b a help but it is not working for me. I got a reply that enabling the mouse over in the report viewer might help, but i dont know how to enable
Though this is not directly a SQL related question but I could not think of some other forum to post this request. <y apologies if I should have posted elsewhere...
I need some sample data for a departmental store (like WalMart of KMart) which sell a wide variety of things and probably everything under the sun :)
I need data in such a manner that we have 4-5 levels of data hierarchy. For example we can have a data hierarchy like follows:
Classification Category Sub Category Product Group Item
The above is just an example but I hope that most of you already know what I neeed. An example of data based on the following hierarchy can be as follows (shown in a tabular manner)
Classification | Category | Sub Category | Product Group | Item --------------------------------------------------------------- Household Items| Electronics| Entertainment| Audio| SONY Room entertainment box, 2 speakers 300 W each, .... Household Items| Electronics| Entertainment| Audio| Phillips Boom Box, ...specifications.... Household Items| Electronics| Entertainment| Video| SAMSUNG DVD Player model SG-17X5 ... Household Items| Electronics| Entertainment| T.V | SONG TRINTORN 51" ..... ... ...
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 with the fields and table which I am using. My table is beneficiary and fields are empid int, fname char(40), benefittype char(4) and benefitpercentage . Following function is working but problem is not getting all results in one row, as described below.
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: (But I have many records like that so definitely I will need counter/function etc to get these data. 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
Hi Experts ! I want to use maximum feature of SQL Server 2005 and ASP.Net 2.0 in making Data Access LayerSuggestions will be welcomed .Thank you RegardsKAMRAN
When i try to copy one table , say for e.g table x from SQL 6.5 to SQL 7.0 it gives me an error that -
'Insert Error , column 46 ( 'Coloumn_name ',DBTYPE_DBTIMESTAMP), Status 6 : Data overflow . Invalid character value for cast specification .'
This column on the source server ( SQL 6.5 ) has datatype 'datetime ' with value 8 and is NULL .
Although there are other columns in this table with datatype as 'datetime' as 8 and NULL , they have been copied successfully to the destination table .Only this specific column is giving an error while copying data .
I am using import export wizard to copy data between servers . Since i have no experience with this , would like to have a solution from you to this problem. It will be great help for me .
Hi,If I have a database with collation Sequence X and I change thecollation sequence of database to Collation Sequence Y , do I have tomigrate the data of tables with collation Sequence X to collationSequence Y or SQl server takes care of migrating the data internally.Thanks in advance.-Kalyan
Hi , I am loading the Data into the Tables with the constraints on and redirecting the error rows into a seperate table is there a way to capture the error rows from a execute sql task by directly loading data without constraints and later adding them with the execute sql task and redirecting them to error table as this approach would make the loads quicker. the approach now that i am using is on a row by row basis ..... and if i drop constraints and load data and then add constraints will this deposit the same error rows as in case of the current approach please send me ur suggestions
I have two data sources - an excel spreadsheet and one access database of Customer details, (quite small in size) and I have to use SQL Server 2005 to Integrate the data and cleanse the data so that I could (in theory) import it into a CRM system (though I won't actually be importing it) as this is for coursework only.
Is there a simple steps to do this is SQL server and guides that I can follow that are relevent? As there are lots of tutorials and I haven't a clue where to start.
Hi I have to import data from a number of excel files to corresponding tables in SQL 2005. The excel files are created using excel 4.0. I have created an excel connection manager and provided it with the path of the excel sheet.Next i have added an excel source from the toolbox to the dataflow. I have set the connection manger, data access mode, and the name of the excel sheet (the wizard detects the sheet correctly) in the dialog window i get when i double click the excel source. Every thing goes fine till here. Now when i select the 'columns' in this dialog window or the preview button, i get this error TITLE: Microsoft Visual Studio------------------------------Error at Data Flow Task [Excel Source [1]]: An OLE DB error has occurred. Error code: 0x80004005.Error at Data Flow Task [Excel Source [1]]: Opening a rowset for "test4$" failed. Check that the object exists in the database.------------------------------ADDITIONAL INFORMATION:Exception from HRESULT: 0xC02020E8 (Microsoft.SqlServer.DTSPipelineWrap)------------------------------ Any ideas about why is this happening??? Umer
Can someone help me with this error, so the page can show the rocords, its works on my PC but not at my host. I get this error: Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
I have to copy data from a view of a database to an Excel file . Is there any way of doing it ? Is there any way to import the data from the views to an Excel format ? We have SQL Server 7.0 .
I have a table in Server A and it has 5 columns. One is Address & ID, CreateDatetime,..
I need to transfer data from this table from Server A to server B for a report pupose. The Address column in this table has some places two address in the table. I am giving ex below
Address Houston, Dallas Redmond Sacramento New Jersey, New York
I want to avoid the rows where address are two Houston, Dallas & New Jersey, NewYork to the destination table in server B and need to do incremental loads.
how to proceed with this?
The version we are using is Sql Server standard edition 2008r2
I have three tables EmpIDs,EmpRoles and LatestRoles. I need to write a select Query to get roles of all employees present in EmpIDs table by referring EmpRoles and LatestRoles.
Where I stuck : The condition is first look into table EmpRoles and if it has more than one entry for a particular Employee ID than only need to get the Role from LatestRoles other wise consider the role from EmpRoles .
Employee ID 2 is having two roles defined in EmpRoles so for EmpID 2 need to fetch Role from LatestRoles table and for remaining ID's need to fetch from EmpRoles .
My Final Output of select query should be like below.
Hi,I wonder if anyone can help with the following on a fee paying basisfor the the design or development of some type of script or utility orpiece of code to do the following work.I wish to retrieve some data from an online database that is in thepublic domain. The online database has a search facility that matchesthe entry (name) in a search box then returns a screen stating that amatch has been found or not found.If a match is found there is a button to click that proceeds to thescreen containing the data which is simply two names. It is these twonames that I wish to retrieve and store them in something like a textfile where they are associated with the original entry (name) used inthe search box.I have a list of the entries for the search box that can be suppliedin sample format for testing as a columnar text file or commadelimited file or a spreadsheet.. I would need the procedure toprocess the list of search entries, retrieve the data then move on tothe next one in the list. Obviously, if a match was not found then theprocess would need to move on the the next entry in the list withperhaps a message saying "No Match" until the entire list wasprocessed.The PC I hope to run the process on is a Windows XP machine and if Ineed to purchase any particular software that is necessary for the jobthen I am quite willing to do so. Also, as I pointed out above I wouldpay for the work to be done.I hope that I have explained the above OK and that I have posted it tothe correct newsgroup(s). If it is not in the correct newsgroup Iwould be grateful if anyone could point me in the right direction.RegardsDave Gibson
I have been trying to write a cursor to fetch required data from table but somehow its running forever and inserting duplicate records.
I have a temp table named getInvoice where I have five important columns
1. invoice number 2.group 3.invoice status 4. Invoice Expiration date 5. Creation date time
and some other columns.One invoice number can belong to one or more group and there can be one or more records for a particular invoice number and group.
An example is below :
InvoiceNumber Group InvoiceStatus InvoiceExpirationDate CreationDateTime
My query condition is complex and that is why Im facing problem retrieving the output.I need a cursor for getting distinct invoice number from the table and for each invoice number I need to get the latest record for each invoice number and suffix combination based on creationdateand time column and if that record has invoice status of 2 and also the invoice expiration date can be either null or greater than today's date, then I need to get that record and put it in a temp table.
The query I wrote is below
declare myData cursor for select distinct invoiceNumber from #getInvoice declare @invoiceNumber varchar(30) open myData fetch next from myData into @invoiceNumber while @@FETCH_STATUS = 0
I am getting the error "The required .svc handler mappings are not installed in IIS" in the Master Data Services Configuration Manager. I am running the configuration tool as administrator on a domain joined machine using a domain user account (which is also a member of the local Administrators group).
My configuration is as follows: Windows 8 SQL Server 2012 RTM + CU 2 (build 11.0.2325).
All required prerequisites should be installed in IIS.I have reviewed this issue: URL...
I have received some reports and I have been asked to decide whether these reports can be developed as an operational report or Analytical Reports.
Basically I wanted to understand what points needs to be considered while deciding whether I should go for Analytical reporting (Cubes) or Operation Reporting.
I have a report with a fixed header that works properly when the query returns results (or fixedheader = false). However, when the result set is empty, I get tenacious client-side "object required" errors. Obviously I can either turn the fixedheaders off or disable debugging in IE, but is there a Microsoft fix for this problem?
I have a table with Million plus records. Due to Running Totals article, I have been able to calculate the Trial_Balance for all months.
Now I am trying to provide a Beginning Balance for all months and the Logic is the Beginning Balance of July would be the Trial_Balance of June. I need to be able to do this for multiple account types. So the two datasets that need to be included in logic is actindx and Calendar_Month.
For actindx of 2 and Calendar_Month of 2014-01-01The Trial_Balance_Debit is 19585.46 This would make the Beginning_Balance of actindx 2 and Calendar_Month of 2014-02-01 19585.46
I am trying to do some type of self join, but not sure how to include each actindx number differently.
Table creation and data insert is below.
SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
SET ANSI_PADDING ON GO
CREATE TABLE [dbo].[TrialBalance]( [Trial_Balance_ID] [int] IDENTITY(1,1) NOT NULL,
I pull data from Sql Server through the query, I want to pass the region parameter to the power pivot connection query. So that I can automatically pull the required region data. The parameter should pick the value from the excel range. And also how to control this through VBA
My web project (ASP.NET 2.0 / C#) runs against sql server 2000 and uses the System.Data.SqlClient.using System.Data.SqlClient; I use System.Data.SqlClient.SqlConnection and System.Data.SqlClient.SqlCommand to make the connections to the database and do selects and updates. Is it correct to continue to use these against SQL Server 2005? I ask because I made a connection string (outside of .Net) for SqlServer 2005 using the SQL native provider and it had the following - Provider=SQLNCLI.1 and any connection strings I had made (also outside of ASP.NET) fro SQL Server all used Provider=SQLOLEDB.1. This is why I wondered if there is a different SqlClient in .Net 2.0 for SQL Server 2005? Cheers Al
Hi everyone,I encountered an error "Need to run the object to perform this operationCode execution exception: EXCEPTION_ACCESS_VIOLATION" When I try to import data from Oracle to MS SQL Server with EnterpriseManager (version 8.0) using DTS Import/Export Wizard. There are 508 rowsin Oracle table and I did get first 42 rows imported to SQL Server.Anyone knows what does the above error message mean and what causes therest of the row failed importing?Thanks very much in advance!Rene Z.--Posted via http://dbforums.com
Using MDS 2012: I have an entity "XYZ_Entity". In "XYZ_Entity" entity I have 2 domain based Columns "DealerGroup" and "Dealer".
While inserting information into "XYZ_Entity" entity user can select the required dealer group from domain base Dealer Group values. Now for selecting Dealer he wants the dealers to be filter based on selected dealer group and he can select from the filtered list. reason to do that is he don't want to go through thousands of dealers and select an incorrect one.
Hi, I was wondering how I can complete a column (which doesnt have an input one) with data. For example:
I have a sql query which bring data of 3 columns
ID | FISRT NAME | LAST NAME 1 MIKE MORGAN 2 SARA JOHANES
So, I will insert that data in a FLAT FILE CONNECTION MANAGER, which I configured with 3 columns and I did the corresponding mapping in the FLAT FILE DESTINTATION.
Now, If I add one more column in the FLAT FILE CONNECTION MANAGER, I will not have it mapped to a input one, obviously. So, what I need is to add one more column to the flat file destination and complete it with zeros values in it.
Probably I can solve this part by introducing a DERIVED COLUMN and there I can configure the zeros that I want to add to the column. But I'm not sure if I can do that without having a input column. So, the question will be, how can I add one column to a flat file which doesnt have a input and introduce any value that I want to it? Hope I was clear Thanks for your help.
I have two tables, one a data table, the other a product table. I want to perform a join on the two tables with values distributed into columns based on the value in the month field.
Hi everyone, I am using SSIS, and I got the folowing error, I am loading several CSV files in a OLE DB, Becasuse the file is finishing and the tak dont realize of the anormal termination, making an overflow. So basically what i want is to control the anormal ending of the csv file. please can anyone help me ???
I am getting the following error after replacing the '""' with '|'. The replacng is done becasue some text sting contains "" wherein the DFT was throwing an error as " The column delimiter could not foun".
[Flat File Source [8885]] Error: The column data for column "CountryId" overflowed the disk I/O buffer. [Flat File Source [8885]] Error: An error occurred while skipping data rows. [DTS.Pipeline] Error: The PrimeOutput method on component "Flat File Source" (8885) returned error code 0xC0202091. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
[DTS.Pipeline] Error: Thread "SourceThread0" has exited with error code 0xC0047038.
[DTS.Pipeline] Error: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.
[DTS.Pipeline] Error: Thread "WorkThread0" has exited with error code 0xC0047039.
[DTS.Pipeline] Information: Post Execute phase is beginning.
Hi there, I am a new member of this site and I am not very much aware of T-sql's working. My question is what if I need to get one column's data to be the heading of another column. To be very exact I have a school's database. The table I am talking about is of the results of students. The table contains Student ID, Subject ID, Total marks of the subject, Marks obtained in the subject. Now I want to print a report by generating data from this table. Right now the data is something like this StuID - - - SubID - - - -Tot - - -Obt 1 - - - - - - -1 - - - - - - -50 - - - 38 1 - - - - - - -2 - - - - - - -50 - - - 41 1 - - - - - - -3 - - - - - - -50 - - - 42 1 - - - - - - -4 - - - - - - -50 - - - 40 2 - - - - - - -1 - - - - - - -50 - - - 35 2 - - - - - - -2 - - - - - - -50 - - - 40 2 - - - - - - -3 - - - - - - -50 - - - 42 2 - - - - - - -4 - - - - - - -50 - - - 41
StudentID and SubjectID fields are related to other tables so I can get the names from there but when I need the report I need the data in the form of StuID - Sub 1 - - - Sub 2 - - - Sub 3 - - - -Sub4 1 - - - - 38 - - - - - - 41 - - - - - - 42 - - - - - - 40 2 - - - - 35 - - - - - - 40 - - - - - - 42 - - - - - - 41
The Subjects can be different for different students so the query should be dynamic instead of hard coding the names of the subjects. I hope I am clear with my question. The subjectIDs or their names will become the headings and they will contain the obtained marks for that subjects in their columns just for the reports. I have also checked the PIVOT function but was not able to do what I wanted. Thanks.