Hi I'm Facing Problem In Adding Values To The Database Sqlserver2k
Jul 9, 2007
hi everyone,
I have a form in in that 3columns and 8rows default.. I have to store values for 8 rows at a time in to database..
I am working with vs2003, asp.net & C# behind the code.. so pls send me a code for implementing this.. asap
Hi guys, I need some help again please. On my page load, I need the following done... I have a label control that must display a certain numeric value. This value must be the sum of an array of values that must be retreived from a table ("Details") with the column name "DealValue" but only where the column "ConsultantID" = txtConsultant.text I understand the select statement, but I don't know how to "run" through the table to add all the values. Can someone please help me with this and how I would construct the MSSql select statement for this. Thanks again
hi folks...now m in serious trouble...i hve a very complicated problem now...
let me explain
i have a table in SQL...I have to select values from this table depending on 2 where conditions.....and add these values......and insert them in another table......
now can somebody tell me how can i add the values from the database and store them in a session and update them to another table...
if i am not clear then ask me i will explain u in more detail
I had taken back up on employee from my office. Office server name is UMASHANKAR. My server name is XYZ. I had attached that back up file BY RIGHT CLICKING :: SERVICE OBJECT-->BACKUP DEVICES-->NEW BACK UP DEVICE.Now i create database of EMPLOYEE my server XYZ. I had tried to restore EMPLOYEE back file by right clicking EMPLOYEE database-->TASKS-->RESTORE-->FILE OR FILEGROUP-->To Database: EmployeeSource of Restore:From Device: Employee.bak(I had selected from file by browsing)i had selected recent back up.But server name in back up is UmashankarMy server name is XYZwhen i am clicking ok then i am getting this error.Restore failed for Server 'XYZ'.(Microsoft.SqlServer.Smo)Additional information:|--> An exception occured while executing a Transact-SQL statement or batch. | --> The media set has 2 media families but only 1 are provided. All members must be provided. All members must be provided. RESTORE DATABASE is terminating abnormally. (Microsoft SQL Server, Error: 3132)Plz solve this problem. I need it urgently
Is it possible for SQLServer to make a http web request in a stored procedure? I know that you can configure it to send email, but I'd rather do that on the webserver side, and that needs to be triggered by a request of some sort. I have a sp that runs nightly, and I'd like it to send out a http request when its done so that I can do further processing/send email/what have you. I haven't been able to find anything on this subject in any of the books I have, and my google-fu isn't strong enough. Thanks for any hints.
If I have a Select statement like this in my C# code: Select * From foods Where foodgroup In (@foodgroup) And I want @foodgroup to have these values ... "meat", "dairy", fruit", what is the correct way to add the parameter? I tried meat, dairy, fruit 'meat', 'dairy', 'fruit' but neither worked. Is this possible?
I have 21 Boolean fields that I would like to calculate a percentage from. If the boolean value is true I would like to be able to return a percentage of Outcomes available from a possible of 21. So If 7 of my boolean fileds are true then i would like to be able to calculate that 33% of Outcomes are present.
Does anyone have anything that will get me started?
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Client]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Client] GO
Well I am the MS-SQL user I always face the problem in my application.After some time my application stop working goes in to the notresponding stage. Then I have to KILL some session which are SPID > 51.After this my problem is getting resolved after this I can able tocreate new sessions. Please help me ot with this issues.regards,Shailesh
Hello all, i have 2 sql tables, and they each contain a column with bigint values. What i want to do is add up the values from both table, and then display it as 1 number. Supposing i have the following table name: DownloadTable fileName | DownloadSize | file1 | 45 file2 | 50 file3 | 20 --------------------------------------------- second table table name: VideoTable fileName | VideoSize | file1 | 40 file2 | 60 file3 | 20 ---------------------------------------- Now, i want this to output 120, wich is the sum of the sum of the values of table 1 and 2 I've already tried the following: SELECT SUM(DownloadTable.DownloadSize) + SUM(VideoTable.VideoSize) FROM DownloadTable, VideoTable However, when i ran this, it gave me a huge number, that was far from accurate from what it was suppose to output. Can anyone help me? Thanks in advance Regards,
I posed this problem a few days ago, but havent been able to generate the results i need. Suppose my resultset from an sql query gathering totalsales for a given day by a salesrep looks like this:Lastname totalsales orderID-----------------------doe 1403 510doe 500 680 doe 200 701using SUM(Accounts.totalsales) is not adding up the totalsales. What do I need to do to add up the totalsales, and then reassign it to a newfield?netsports
select (sum(ColA) + sum(ColB) + sum(ColC)) / 3 from tableA Where ....
I want to add the sum of the columns and then divide it by a constant. The problem I am having is there are a lot of nulls in the database that I am working on (i.e. one of the values in the ColB is Null, which makes the result of the entire expession null).
How do I get around this. I need to add the values of the columns?
I have a table with 6 columns. which we can call a, b, c, d, e, f. What I want to achieve is to put data in column d and e and then split this result in column f.
The data I want to put in column d and e is already exported and executed from a table called exp_data, which is from a period of november.
So this is what i have so far but is not working:
update split_table set d = select amount from exp_data where period = '1111' and exp_data.account = split_table.b and exp_data.company = split_table.a
The error I get is incorrect syntax near select. Fixed the issue by adding a parenthesis before the select until the end...
Hi! I have one table with thousands of records. Now, I have to add one more column to that table. And this new column will contain concatination of two columns in that same table. Is there any command to do this? My table has two columns as 'file', 'extn', now i want to add 'fullname' column to that table, and it will contain the concatinated value of 'file' and 'extn'. If the 'file' field has one record as "myfile", 'extn' has one record as ".doc", I want to insert "myfile.doc" in the new column 'fullname'. Like this my table has thousands of records. How can i do this? Please help me! Thanks in advance!
i insert the names of the collumns in the design of the sql server and in some of the names it add the brackets. for example [LabsRadiologyBiochemAmylase>125mMolPLitre]. i try to remove them but when i save it, it write them again. can someone explain me how to remove the brackets???
I am facing Timeout Error as i am using SQL Server 2005 as a database and in database set pooling property as 0 and RemoteTimeout as 0 also as a front end i am using .net 2005 and in web.config file i set pooling=False but then also i am getting the following error.Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. What can i do then...?
I am building a website in asp.net 1.1 with vb.net 2003 which will have the standings of the teams in our baseball league. Below is the database table I have created.
ID(int) home_team (nvarchar) away_team(nvarchar) win_teampf(nvarchar) lose_teampf(nvarchar) 1 Elmwood Murdock 7 22 Louisville Manley 4 33 Manley Elmwood 9 8 ID is the primary key. What I am attempting to do is add each instance of Elmwood from the win column to output the total number of wins from Elmwood and do the same for Elmwood in the losing team to output the total number of losses. The result will look something like this: Elmwood: 1 Win 1 Loss. .500 Thanks for your reply.
Whats the fastest easiest way to take a select that returns say 4 values for the expression into a single column on defined row
basically I mean i want to do an update to say a persons i dunno ummm places they have traveled and I want it listed like france;usa;germany etc etc and the data would always be in the tables i pull from so I can overwrite the data each time i run it but has to take 3 or more values from a query and put them in separated by say a ; into the same persons coloumn that stores the info.
I did this once before with a cursor and adding a variable to itself with colasce or whatever the command was, but was just wondering if there is a fast way to do this by chance that im not thinking about :P.
This is probably the wrong category to post my question in. Apologies if it is.
I have got a Data Flow Task that has an OLE DB Source and a Flat file destination.
Is there a way to do the following:
SELECT id,'31809','C:LCImportDataImages' & id & '.jpg', '1' FROM table1
This obviously doesn't work but I want to insert the id from the table, followed by the value '31809', followed by 'C:LCImportDataImagesid.jpg', followed by '1'
So, the id in 'C:LCImportDataImagesid.jpg' is the same as the id from the table.
I have an SQL Select statement that I need to add a column to called SalePrice, the SalePrice column needs to be calculated by adding together the values of 12 columns, then multiplying that value by the value in a another column to calculate margin. My issue is that I can only get it to add 7 column values together, if I add any more columns to the equation it just returns and null result. My DB is SQL 2005 Express SP2. My select statement is below: SELECT dbo.MFG_DATA_Machines.ID, dbo.MFG_DATA_Machines.MachineName, dbo.MFG_DATA_Parts_CPU.PartDescription AS CPU, dbo.MFG_DATA_Parts_CPU.PartCost AS CPUCost, dbo.MFG_DATA_Parts_Motherboard.PartDescription AS Motherboard, dbo.MFG_DATA_Parts_Motherboard.PartCost AS MotherboardCost, dbo.MFG_DATA_Parts_RAM.PartDescription AS RAM, dbo.MFG_DATA_Parts_RAM.PartCost AS RAMCost, dbo.MFG_DATA_Parts_HDD.PartDescription AS HDD, dbo.MFG_DATA_Parts_HDD.PartCost AS HDDCost, dbo.MFG_DATA_Parts_OpticalDrive.PartDescription AS OpticalDrive, dbo.MFG_DATA_Parts_OpticalDrive.PartCost AS OpticalDriveCost, dbo.MFG_DATA_Parts_Video.PartDescription AS Video, dbo.MFG_DATA_Parts_Video.PartCost AS VideoCost, dbo.MFG_DATA_Parts_OS.PartDescription AS OS, dbo.MFG_DATA_Parts_OS.PartCost AS OSCost, dbo.MFG_DATA_Parts_Modem.PartDescription AS Modem, dbo.MFG_DATA_Parts_Modem.PartCost AS ModemCost, dbo.MFG_DATA_Parts_FloppyDrive.PartDescription AS FloppyDrive, dbo.MFG_DATA_Parts_FloppyDrive.PartCost AS FloppyDriveCost, dbo.MFG_DATA_Parts_CardReader.PartDescription AS CardReader, dbo.MFG_DATA_Parts_CardReader.PartCost AS CardReaderCost, dbo.MFG_DATA_Parts_PowerSupply.PartDescription AS PowerSupply, dbo.MFG_DATA_Parts_PowerSupply.PartCost AS PowerSupplyCost, dbo.MFG_DATA_Parts_CaseType.PartDescription AS CaseType, dbo.MFG_DATA_Parts_CaseType.PartCost AS CaseTypeCost, dbo.MFG_DATA_Machines.Notes, dbo.MFG_DATA_Machines.MarginPercent, dbo.MFG_DATA_Machines.PriceOverride, (dbo.MFG_DATA_Parts_CPU.PartCost + dbo.MFG_DATA_Parts_Motherboard.PartCost + dbo.MFG_DATA_Parts_RAM.PartCost + dbo.MFG_DATA_Parts_HDD.PartCost + dbo.MFG_DATA_Parts_OpticalDrive.PartCost + dbo.MFG_DATA_Parts_Video.PartCost + dbo.MFG_DATA_Parts_OS.PartCost + dbo.MFG_DATA_Parts_Modem.PartCost + dbo.MFG_DATA_Parts_FloppyDrive.PartCost + dbo.MFG_DATA_Parts_CardReader.PartCost + dbo.MFG_DATA_Parts_PowerSupply.PartCost + dbo.MFG_DATA_Parts_CaseType.PartCost) * ((dbo.MFG_DATA_Machines.MarginPercent + 100) / 100) AS SalePrice FROM dbo.MFG_DATA_Machines LEFT OUTER JOIN dbo.MFG_DATA_Parts_CaseType ON dbo.MFG_DATA_Machines.CaseType = dbo.MFG_DATA_Parts_CaseType.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_Motherboard ON dbo.MFG_DATA_Machines.Motherboard = dbo.MFG_DATA_Parts_Motherboard.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_Video ON dbo.MFG_DATA_Machines.Video = dbo.MFG_DATA_Parts_Video.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_RAM ON dbo.MFG_DATA_Machines.RAM = dbo.MFG_DATA_Parts_RAM.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_PowerSupply ON dbo.MFG_DATA_Machines.PowerSupply = dbo.MFG_DATA_Parts_PowerSupply.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_OS ON dbo.MFG_DATA_Machines.OS = dbo.MFG_DATA_Parts_OS.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_OpticalDrive ON dbo.MFG_DATA_Machines.OpticalDrive = dbo.MFG_DATA_Parts_OpticalDrive.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_Modem ON dbo.MFG_DATA_Machines.Modem = dbo.MFG_DATA_Parts_Modem.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_HDD ON dbo.MFG_DATA_Machines.HardDisk = dbo.MFG_DATA_Parts_HDD.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_FloppyDrive ON dbo.MFG_DATA_Machines.FloppyDrive = dbo.MFG_DATA_Parts_FloppyDrive.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_CPU ON dbo.MFG_DATA_Machines.CPU = dbo.MFG_DATA_Parts_CPU.ID LEFT OUTER JOIN dbo.MFG_DATA_Parts_CardReader ON dbo.MFG_DATA_Machines.CardReader = dbo.MFG_DATA_Parts_CardReader.ID
I'm trying to put a range of dates into the datatextfield of my ddl. I'm using the query:
string strProps2 = "SELECT sc_id, cast(begin_date AS varchar) + ' - ' + cast(end_date AS varchar) AS XYZ From Archived_Property_Changes WHERE Property_number = " + qryPN + " ORDER BY end_date";
but it gives me an empty ddl. the datavaluefield shows the correct results, but it's not displaying the correct data from the datatextfield. I removed the casts from the SQL query and it returns:
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value
Below is my ddl code:
SqlCommand objCommandProps2 = new SqlCommand(strProps2, myConnection); SqlDataReader objReaderProps2 = objCommandProps2.ExecuteReader();
HiI've got a quandry - I have a detailed database that handles advertorders between a design agency and printers / magazines etc.I want to add up the total spent by the client and put the results to afield.I've actually done that using a query table in access - it should bequite simple as i can bind the 'total amount' to my table - the onlything it does not currently do is filter the total based on the monthselected.For example if you look athttp://www.daneverton.com/dg2data/months/2006-12.aspThe data here is filtered by the issue equaling Dec-2006The actual order total is £13,622 but the column is showing the totalfor all entries to date (a years worth = £ 422,048)I'm sure that there is only a basic tweak required but i'm banging myhead over what to doThe sql is "SELECT * FROM monnodraught, q_monodraught_total WHERE[Issue / Edition] LIKE ? ORDER BY Publication ASC"Any help gladly received.
I'm trying to write a stored procedure that performs a select statement of the RequestID column and the total of the disk size for that row. ie the values on RequestAdditionalDisk1Size + RequestAdditionalDisk2Size + RequestAdditionalDisk3Size where the Requester equals a certain value. I can perform the select statement fine on the individual values, how to add the values of the Disk sizes together and present that back in the select statement.So far the code looks like but is giving me an error around the line performing a SUM.
-- Author:<Author,,Name> -- Create date: <Create Date,,> -- Description:<Description,,> -- ============================================= ALTER PROCEDURE [dbo].[spMyRequests] -- Add the parameters for the stored procedure here
I am mapping an entity from SQL 2005 to another entity in another system on SQL 2000. Since the destination system has its own ID generator, I want to keep the generated ID for each row of my table in a column of my table in SQL 2005. The new column is in the dataset now , but I don't know how to update my table to have that column values (The OleDbDestination just insert new items.)
I am facing problem while processing my SSIS package
The error is: "Invalid delimited data. Text qualifier must be followed by a column delimiter (except for the last column)."
The text qualifier is the double-quotes character “. Text fields are supposed to get a double quote at the beginning of the string and one at the end. The column delimiter is the upright bar or pipe character |.
Some of the descriptions in table column have double-quotes embedded within the text string. When SSIS encounters one of these embedded quotes, it thinks that is the end of the text string and expects to find the column delimiter character next. It doesn’t, because the " is embedded between other alphabetic characters, so it raises an error.
For example if my column value looks like Test"String"One
What old DTS doing: DTS make the embedded " into "". The resulting text string then would look like this: "Test ""strings"" one".
When running the same data into a database using DTS, DTS recognized automatically the "" in the string and changed it to " so in the target the string looked like this: test "string" one. No problem.
SSIS, however, does not allow and does not support doing this "doubling" of embedded " when you are using " as the text qualifier. So it exports the sample string above like this (I added the column delimiters as well): |"test "string" one"|.
This is the Trigger which is not working properly during Update, no anyrecord is going to be updated so pls help.I am updating the requisition table when any update in quantity inpodetails tableCREATE TRIGGER trig_updateRequistion ON ERP.DBO.TranPurchaseOrderDetailINSTEAD OF UPDATEASIF UPDATE(Quantity)BEGINUpdate RequisitionSlipDetailset RequisitionSlipDetail.PoQuantity =(Select PoQuantity from RequisitionSlipDetail whereItemCode=(Select CAST(i.ItemCode as nvarchar(20)) from inserted as i)andRSlip_No=(Select CAST(i.RSlip_No as int) from inserted as i))-((Select Quantity from TranPurchaseOrderDetail where Purchase_OrderNo=(Select CAST(i.Purchase_OrderNo as nvarchar(20)) from inserted as i))- (Select CAST(i.Quantity as int) from inserted as i))where RequisitionSlipDetail.ItemCode = (Select CAST(i.ItemCode asnvarchar(20)) from inserted as i) and RequisitionSlipDetail.RSlip_No =(Select CAST(i.RSlip_No as int) from inserted as i)Update TranPurchaseOrderDetail setTranPurchaseOrderDetail.Quantity =(Select CAST(i.Quantity as int) from inserted as i)where TranPurchaseOrderDetail.Purchase_OrderNo = (SelectCAST(i.Purchase_OrderNo as nvarchar(20)) from inserted as i)andTranPurchaseOrderDetail.ItemCode = (Select CAST(i.ItemCode asnvarchar(20)) from inserted as i)andTranPurchaseOrderDetail.PurchaseDetailId =(Select PurchaseDetailId from TranPurchaseOrderDetail wherePurchase_OrderNo = (Select CAST(i.Purchase_OrderNo as nvarchar(20))from inserted as i))END
I have placed a textbox in a page footer of SSRS which is linked with a databound text box in the body of the report.. which i intended would give the report databound footer... but now the problem is tat they dont show up on every page.. earlier they use to mostly not show up at all or show up on the first or the last page...
could some1 help.??
once i render it to pdf.. all the page footers cant be seen.
As I just need the highest value returned I'm attempting to use MAX. However, the problem is that all values are being returned in the DaysOfWeek column as 5 even though they may range anywhere from 1-7. The DaysOfWeek should be for a unique EmployeeID/ReportID combination.
WITH sub AS( SELECT Shifts1.EmployeeID, X.*, Schedule.ReportID FROM ( SELECT CASE WHEN [M] = '1' THEN 1 ELSE 0 END +
The driver table , which keeps track of what datamarts ran and for what date range gets updated frequently during the etl run . There can be as many as 250 updates issued on this table in a single second.
Now this table is a heap , and there are no indexes on it .
During these updates , we encounter deadlocks causing the ETL job to fail .
data source=RemoteHostName;initial catalog=myDb;password=sa;user id=sa; Max pool size = 200;
And now strange thing is happening ,, I am receiving error :
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached
The SqlServer Activity Manager is telling that only 100 connections are pooled, and I guess that the Max pool size is 100, It is not being changed by my Connection string. As I am trying to change the default 100 pool size value to 200.
Huh , So stucked up , how to increase the Max pool size.. Is there any way .