Updating The SQL Data
Sep 12, 2006
skumar writes "Hi guys,
i'm a newbie in database and i need some ideas for the below mentioned
problem.
i'm creating sql table from a txt file using DTS package, now once the table
gets created, i need to multiple some revenue accounts with xyz number and
expense accounts with abc number.
i'm thinking more towards the line of writing a store procedure but don't
have any experience in it.
PLease guide me in the right direction, also if a good book could be refered
for future; which will help me query language and this kind of issues, that
will be GREAT!!
Thanx in advance"
View 2 Replies
ADVERTISEMENT
Sep 21, 2006
I am very new to SQL Server 2005. I have created a package to load data from a flat delimited file to a database table. The initial load has worked. However, in the future, I will have flat files used to update the table. Some of the records will need to be inserted and some will need to update existing rows. I am trying to do this from SSIS. However, I am very lost as to how to do this.
Any suggestions?
View 7 Replies
View Related
Nov 17, 2006
Hi,
I am trying to setup Trans Replication with updating subscriber on sql2000. One column on few tables got data with single quote (').
How do I handle in this case? Did any one come across such case?
Can I Change default QUOTED IDENTIFIER from ' (single quote) to something else (@@@) on SQL2000?
If yes, how to do?
Thanks
mka
View 1 Replies
View Related
Apr 18, 2008
building some kind of ecommerce site.
I want to allow the user to modify the image that he has stored for a product.
The image is stored in a directory, in the table GAMME I only have the image name.
When the user selects a new Image, I first delete the old image in the directory, then save the new image, but what I can't do is to update the table with the new image name, when I write sqldatasource1.update() I have an error "the dictionnary passed with old values is empty"(translated from frengh).
the update statement in sqldatasource1 is: " UPDATE Gamme SET imagename = @imagename, imagesize = @imagesize WHERE (product_ID = @original_product_ID)"
on events sqldatasource1.updating I have written:
e.Command.Parameters("@imagename").Value = (FileUpload1.FileName).ToString()
e.Command.Parameters("@taillevignette").Value = FileUpload1.PostedFile.ContentLength
e.Command.Parameters("@original_product_ID").Value = Session("Product_ID").ToString
this is not written but the session("product_ID") is the good value
the problem must come from the last lign, but I don't Understand the problem and how to solve it.
View 1 Replies
View Related
Oct 2, 2000
Hi,
I would like to update about 4,000 records. I would only be updating one column for 4,000 rows in a table that has 50,000 rows. The update information is not the same for each row. I will be updating this from an excell file. Can somebody please tell me how to do this without messing the rest of the data in the table?
Thank you
JG
View 1 Replies
View Related
Apr 23, 1999
I rebuilt my databases using bcp,in order to change sort order and char set. That was OK,the data were re-inserted,but now i can only modify data by SQL Server Enterprise Manager.When a try to chage data by Visual Data Manager or VB application using ODBDC,it's accused that the database is not updatable,it's read only.But in the properties it's updatable.Anybody has a hint of what'sgoing on??
Thanks for yoour attention again,
Luciano
View 1 Replies
View Related
May 13, 2008
Hi,
What is the best to update line_no in following code.
As you can see 1 invoice can have multiple lines.
I would like to assign sequential number to all lines in invoice.
CREATE TABLE #xx (invoicenumber INT, line_no int )
INSERT INTO #xx VALUES(1000,0)
INSERT INTO #xx VALUES(1000,0)
INSERT INTO #xx VALUES(1000,0)
INSERT INTO #xx VALUES(1000,0)
INSERT INTO #xx VALUES(2000,0)
INSERT INTO #xx VALUES(2000,0)
INSERT INTO #xx VALUES(2000,0)
INSERT INTO #xx VALUES(2000,0)
SELECT * FROM #xx
result of select * from #xx should be:
10001
10002
10003
10004
20001
20002
20003
20004
Thanks
mk_garg
View 2 Replies
View Related
May 13, 2008
Hi,
What is the best to update line_no in following code.
As you can see 1 invoice can have multiple lines.
CREATE TABLE #xx (invoicenumber INT, line_no int )
INSERT INTO #xx VALUES(1000,0)
INSERT INTO #xx VALUES(1000,0)
INSERT INTO #xx VALUES(1000,0)
INSERT INTO #xx VALUES(1000,0)
INSERT INTO #xx VALUES(2000,0)
INSERT INTO #xx VALUES(2000,0)
INSERT INTO #xx VALUES(2000,0)
INSERT INTO #xx VALUES(2000,0)
SELECT * FROM #xx
result of select * from #xx should be:
1000 1
1000 1
1000 1
1000 1
2000 2
2000 2
2000 2
2000 2
Thanks
mk_garg
View 3 Replies
View Related
Jun 24, 2008
I have posted on this problem before, and got some wonderful help, but the problems keep growing!
In my table, I have projects,activities, credit amount, debit amount, starting balance.
Each project can have several activities associated with it. Each project has a starting balance. Each activity posts an expense to the starting balance of the project.
If the project has enough money to handle the charges made by the activities, all the activity expenses can be "posted". Then I want to re-adjust the balance and
check the second activity. If there is still enough money to handle the charge from the second activity, then the expenses can be posted and the balance
adjusted again. In this checking, I am creating a field called status, and flagging if the activity can clear or not, and a new balance field. The data I have can fall into
different examples, listed below.
First example:Only one activity for a project
project: 122400
activity: 0000
Cr_Amt: 2145.00
Dr_Amt: 0
Balance: 1190.00
In the above case, as the balance is less than the Cr_Amt, I want to set the Cr_Amt = Balance, and the new balance = 0 and have done that as follows:
Update r
set r.Post_Cr = r.Bal_2300,
r.new_Status = 'Can Clear',
r.new_Balance = 0
From Rev_Rec_Check r
WHERE r.project IN (Select project
from Rev_Rec_Check d
group by d.Project
having count(d.project) = 1)
That seems to work for me.
Second Example: More than one activity, with credits and debits
project: 145587
activity: 0000
Cr_Amt: 0
Dr_Amt: 2500
Balance: 1452
project: 145587
activity: 0110
Cr_Amt: 3953
Dr_Amt: 0
Balance: 1452
So, in this case, I need to add the Dr_Amt to the Balance and create a new balance (3952), and then check that the Balance can cover the Cr_Amt
UPDATE t
SET t.New_Balance=(t.Bal_2300 + b.postDrSum) - b.PostCRSum,
t.New_Status=(CASE WHEN (t.Bal_2300 -b.PostCRSum) >0 THEN 'Can Clear'
ELSE 'Still Check'
END)
FROM Rev_Rec_Check t CROSS APPLY
(SELECT SUM(post_Cr) as postCrSum, SUM(post_Dr) as postDrSum
FROM Rev_Rec_Check a
WHERE (a.project =t.project)
AND (a.activity<=t.activity)) b
This does seems to work, and gives me the correct status, and adjusts the new balance correctly, but I realize that doing that doesn't achieve what I want.
Ideally, in this example - where there is more than one project/activity, this is what I would like to see:
project: 145587
activity: 0000
Cr_Amt: 0
Dr_Amt: 2500
Balance: 1452
newBalance: 3952
project: 145587
activity: 0110
Cr_Amt: 3952
Dr_Amt: 0
Balance: 1452
newBalance: 0
I want the amount that gets posted (the Cr_Amt) to reflect what is left in the balance.
There could be cases where there are several activities for one project, so I want to be able to scroll through each activity and post what I can from what
they have left in their balance.
I don't know how to approach this. Am I making it more complicated than it actually is? Have I made any sense in trying to explain it?
Thanks in advance for any help!
View 6 Replies
View Related
Oct 12, 2007
I have the following below. I have a page that has a text box. I want it to look in the database (SQL Server 2005) and display the number (Assessor_Score) in the box if it exist. If it does not exist I want the user to put a number in and have it insert a new record to the database. I also want the user to be able to change the number that does show up. The code below just inserts two identical records into the database. Also, how do I assign Assessor_Score a value from the textbox to use in the insert statement? Thanks
Dim pageTitle, sRedirect, str
pageTitle = "QRS Assessors's Score"
dim iAsmtID, sSubScale_Short, Assessor_Score, sScale, sSubScale
Assessor_Score = request.Form("Assessor_Score")
sRedirect = request.QueryString("sRedirect")
iAsmtID = request.QueryString("iAsmtID")
sScale = request.QueryString("sScale")
sSubScale_Short = request.QueryString("sSubScale_Short")
sSubScale = request.QueryString("sSubScale")
sFormAction = "/Member/FSR/FSR_ScoreSheet.asp?iAsmtID=" & iAsmtID
'Open Connection
set conn = Server.CreateObject("ADODB.Connection")
conn.open NCRLAP_Conn
set rs = Server.CreateObject("ADODB.Recordset")
set rs2 = Server.CreateObject("ADODB.Recordset")
''''''''''''''''''Get QRS Assessor's Score''''''''''''''''''
str = "SELECT AssessorScore.iAsmtID, AssessorScore.sSubScale_Short, AssessorScore.Assessor_Score FROM AssessorScore WHERE (((AssessorScore.sSubScale_Short)='" & sSubScale_Short & "') AND ((AssessorScore.iAsmtID)=" & iAsmtID & "))"
set rs = conn.execute(str)
If rs.EOF = True then
'This score is not currently in Assessor_Score
'Insert now
str = "INSERT INTO AssessorScore (iAsmtID,sSubScale_Short,Assessor_Score) " & _
"VALUES ('" & iAsmtID & "','" & sSubScale_Short & "','" & Assessor_Score & "')"
response.Write(str)
conn.execute(str)
Else
This score is currently in Assessor_Score
Assessor_Score = rs("Assessor_Score")
UPDATE now
str = "Update AssessorScore SET AssessorScore.iAsmtID = " & iAsmtID & ", AssessorScore.sSubScale_Short = " & sSubScale_Short & ", AssessorScore.Assessor_Score = " & Assessor_Score & " WHERE (((AssessorScore.sSubScale_Short)=" & sSubScale_Short & ") AND ((AssessorScore.iAsmtID)=" & iAsmtID & "))"
End If
'response.Write(str)
set rs = nothing
conn.execute(str)
str = ""
View 1 Replies
View Related
Feb 20, 2006
Hello.
Is it possible to somehow update data as it is copied from source to destination using SSIS.
Currently I extract data from Database A, load it into database B, then clean/update the data in database B and then load it into database C using DTS on 2000.
What I would like to do is extract data from database A, clean/update it, then load it straight into database C without having to load it into database B first.
I am unable to clean/update the source data in database A, as this would be the obvious thing to do.
Thanks.
View 15 Replies
View Related
Oct 4, 2006
hello guyshere is my problem:i am developing a asp.net web app in .net 2.0. i have some sensitive data in my database. which is encrypted using DES ( with some key which is only known by the top level authorities ). now there is an option of changing the secret key. on changing the key the sensitive data has to decrypted using the old key and then again encrypted using the new key. Now if the no of records increases i am afraid that it might take a longer time and the application might look as it got hanged. guys i have no clue on how to do this. if you guys have any idea on how to implement this please let me know. any help would be appreciatedVignesh
View 7 Replies
View Related
Mar 19, 2007
hello all,
I ran into a problem using the "sql data source updating " method. i'm using a form view with about 20 parameters that are bind to controls in the form view and 5 other parameters that i'm setting the value to in the "sql data source updating" method. Every thing updates find execept for the last 5 parameters that i'm setting the values to in the "sql data source updating" method. My store procedure(sp) updates and insert mulitple tables. For some UNKOWN reason the tables that uses the parameteres in the "sql data source updating " are inserting multple records when only 1 record should be inserted. Have anyone have this problem?
View 1 Replies
View Related
May 25, 2008
I have a database which is used for the asp.net login control and i use the same database for my website work too. In this database there are asp.net created tables for login controls and the tables that i have created for the website. Now when i add a user to the website, data is added in the asp.net created tables (like aspnet_membership, aspnet_users). I want to add some of the data that is added to these tables into the tables that i have created. Is there a way i can do this?
View 4 Replies
View Related
Feb 20, 2004
Hi,
I want to get (SELECT??) data from a db (SQL), edit the data (+1) and then update (UPDATE??) the table with the edited value. How do I get the value from the db and then edit it and then update the field in the db?? Does someone has an example so I get on the way??
Thanks,
Roel
View 9 Replies
View Related
Jun 2, 2006
Sorry if this is a dumb question but I am just learning ASP.NET. My database is on a server running SQL Server 2000 and I have used Dreamweaver to build sites. I am trying to convert to ASP.NET.
The problem I am having is that data is not updating when I change it in a GridView, DataList, etc. I have tried including the user name an password in the connection string without success. What did I miss?
connectionString="Data Source=<ServerName>;Initial Catalog=<DatabaseName>;Integrated Security=True;Uid=sa;Pwd=<Password>;"
This is the string I use in Dreamweaver which works;Driver={SQL Server};Server=<ServerName>;Database=<DatabaseName>;Uid=sa;Pwd=<Password>;
View 2 Replies
View Related
Feb 18, 2002
Hello, I am a relatively new user to SQL so forgive me if the solution is not very dificult :) I have a SQL database that contains a products table that includes part numbers with part descriptions. I need to change all the part descriptions (over 6000 records) so I exported the table into Excel. All the changes have been done in Excel but i am having problems trying to re-import the new data into the existing table. Any info would be appreciated. Thanks
View 4 Replies
View Related
Apr 19, 2006
I am relatively new to SQL and am having trouble with an update. I know I cannot use a join update and have to use subquery. I am not sure of the syntax on how to do this. Below is basically what I want to do, but cannot figure out how to do it with a subquery. Any help would be appreciated.
update revisedapps
set alternateapp = t.alternateapp
from tempalternateapps t
join revisedapps r on t.appname = r.softwarename
View 3 Replies
View Related
Sep 28, 2007
Hi,
Could someone please tell me how to update data in a column that contains unicode data in SQL 2000?
I know how to write update scripts on my own, but when it comes to Unicode character updates I canÂ?ft manage. In the script that I have pasted below I can update the customerÂ?fs details, but this only works if I update with Romaji characters (non-unicode).
The data that I need to update is in Japanese Kanji, but when I use the 'Update' script below, the data is updated as all question marks (???????????).
Is it very much harder to get the script to where it will handle Unicode characters and insert the correct data?
UPDATE CUSTOMER_LANGUAGE_DETAILS
SET FIRST_NAME = '‰h�s'
WHERE CUSTOMER_ID = 1592
View 1 Replies
View Related
Oct 2, 2007
Hello everyone,
Can someone help me with updating data into a view using triggers?
I am struggling hard to write a trigger or stored procedure to update the values on the base tables of the view.
Please help me out...
Thanks,
Godwin
View 5 Replies
View Related
Jul 23, 2005
Hey...newbie question: I've got three columns in my database, thethird of which is blank right now, and I need it to equal the value ofcolumn one minus column two. While I can accomplish this in the .aspxpage with a subroutine, I want to do it in SQL Server so I can simplyread the data in the page and not have to do any calculations. Helpplease? Thanks.Erik
View 5 Replies
View Related
Jul 20, 2005
First of all I don't normally use SQL, so please excuse my ignorance.1st QueryWe have a table with a column with data that looks like this:AMTL03256636What I need to do is change the AMTL portion of the column to another set ofcharachters i.e TESTCurrently i'm extracting the data, loading it into excel changing the dataand then bulk inserting it backinto the SQL7 table. Is there away to change the AMTL without the othersteps?Alan
View 3 Replies
View Related
Jul 20, 2005
First of all I don't normally use SQL, so please excuse my ignoranceThe following query Selects data based on another table.SELECT A.DSTRCT_CODE, A.WORK_ORDER, A.WO_TASK_NO, A.WO_TASK_DESC,A.TASK_STATUS, A.WORK_GROUP, A.CREW,A.WORK_CENTRE, A.ASSIGN_PERSON,A.JOB_DESC_CODE, A.SAFETY_INSTR, A.COMPLETE_INSTR, A.COMPLETED_BY,B.DSTRCT_CODE, B.WORK_ORDERFROM MSF623 A ,MSF620 BWHERE B.DSTRCT_CODE = 'TEST'AND A.DSTRCT_CODE = 'AMTL'AND A.WORK_ORDER = B.WORK_ORDERWhat I need to do is update A.DSTRCT_CODE column to read 'TEST'.Currently I take the data selected and dump it into excel, change theDSTRCT_CODE field and then upload load using a BULK INSERT statement.Is it possible to insert into the query an update statement? Is thereany special sytax that I should use.Alan
View 3 Replies
View Related
Jan 28, 2008
I'm an sql/SSMSE novice, but have successfully connected to my sql database on a webserver.
My question is: Can I update the table data "directly" using SSMSE's interface, or do i have to run an sql update statement? (By updating table data directly, i mean: can i view the contents of a table, and simply edit the data in a field, like with in an MS Access table?) If I can update the data "directly," how does one do that?
Thanks a lot!
Murray
View 3 Replies
View Related
Apr 15, 2007
Hi,
I'm after hosting a website with basically a table in it that is linked to a MS SQL Server 2005 database, which I want to update on a pretty much continual basis from my own server PC which I'm running a data mining tool that updates the MS SQL Server 2005 database.
Any idea on how I would achieve this, or any pointers would be much appreciated.
Thanks,
Tom
View 1 Replies
View Related
Apr 29, 2008
Hello,
I have a ta ble that has 2 columns(licenseplatenumber,vehicletype) and a second table that has 20 or more columns but has(licenseplatenumber,vehicletype) too. The first table got changed once because vehicletype changed from central office for each licenseplatenumber, and i was wondering if there is a way to update the second table with the data from the first table with one or two statements, and not one-by-one. there are alot of data to be changed.
thank you in advance..
View 1 Replies
View Related
Aug 17, 2006
Hi,
I'm very new to SSIS so excuse any ignorance...
Im trying to update a set of records in an oracle table based on the results of a query against a SQL Server 2005 table. I would prefer not to run the update query for each result in the source query (but will do it if only way possible), so I have built a script task which builds a comma separated string of Ids that I can use in an in clause... Hence the query I want to execute is of the form:
update MyTable
set STATUSID = 2
where ID in ( 3,4,5,6 )
When I try and execute this query using an 'Execute SQL Task' in debug mode the package gets 'Stuck' on this task. The task turn yellow as though it is executing but never continues - no errors either.
Is it possible to execute an Update statement against Oracle using the Execute SQL Task? Any suggestions for alternatives?
Thanks for any help...
Scott..
View 6 Replies
View Related
Oct 28, 2006
Here is my scenerio: I have a few older tables with a few thouands of records that I inherited. I am using data access pages as the front-end for now which is very limited. I made List_Tables for common values example below: I am trying to use these List_Tables to Input Data Consistently via Dropdown lists. I am able to input data into the Old Table from the Data Access Page /w the List_Table Dropdown, but I am unable to read any data from the Old Table on the front-end even is the data is the same. Once I enter a value from the New Table it will display. Is there a way for me to update the data value from the old table to that of te new table? A case statement or something so my New Table Dropdown will display everything? Very Confusing it's not to fun if there is a perferred method links ect. would be highly appreicated.
Old Table Patient /w PK - FK
Id#
Firstname
Lastname
Age
Sex
Building#
New Table List_Building
Buildings
Values:
BuildingA
BuildingB
BuildingC
BuildingD
View 8 Replies
View Related
Aug 8, 2007
Can anyone give me ideas on how I can update a table with new data while keeping the old data. Just append the new data - doing this in an ssis job? Ive been trying to use the ole db command transaction but i cant seem to get it working and I have about 10,000,000 rows this method would be slow.
any suggestions would be appriciated
View 3 Replies
View Related
Feb 7, 2008
hi,
i have 2 user defined variables one as integer and the other as string in my SSIS package.
am using these variables to update a row in one of the oracle tables I have.
update A set LOADED=@rows where sudit='" + @audit + "'
I declared @rows as Int32. But LOADED is declared as number(7,0). Due to this the row does not get updated.
Can anyone please suggest a way to resolve this issue and update the row. Thank you in advance.
View 3 Replies
View Related
Apr 25, 2008
Hello all, quick question and then a little background.
Could someone point me in the right direction when it comes to updating remotely deployed instances of a SQL CE database? I don't expect someone to code my project for me, but I'm getting lost in the sea of information and haven't found anything that looks like what we need yet.
What's going on is that I was given the wonderful opportunity to learn SQL.NET programming from the other side of application development. I'm not a beginner programmer by any means, but kind of a newbie when it this level of SQL deployment. What we are trying to do is give our users applications that use a local instance of the larger SQL database we have on the server. We were thinking that deploying SQL CE databases created from the master DB would be a good solution since it is supposed to have updating capabilities, which would be wonderful since then the users wouldn't have to be burdened by having to manually download and update a huge database install file every time we updated the information in the master.
What I'm finding though (after going throught the tutorials), is that the RDA feature (this would only need a pull function) that we were hoping to use requires that you delete the entire table, and then replace. If the master DB has only a few record changes in several scattered tables, it seem that this operation would be similar in size and resource demands as just re-downloading the entire database again (~2.7 gigabytes and growing).
Is there a function that can use a feature on the field properties that can download and replace only those fields/records that have changed intead of basically replacing the entire database?
Sorry if this seems like a painfully obvious question, but I have been looking for a while and haven't been able to find it.
thanks a ton in advance!
Brian
View 4 Replies
View Related
Jul 31, 2006
Can you describe the best (or your preferred) method for updating data held in a related table using Visual Studio 2005 and SQL Server.
For example; if you had a stock control system with the product names and current stock levels in one table and all stock movements in and out held in another table, what is the best, fastest, safest and most reliable method of inserting a stock movement and then updating the current stock level?
I have tried a couple of different methods but would really appreciate a wider range of opinions.
Thanks
View 2 Replies
View Related
Aug 1, 2006
Hey guys this is a SQL Server 2005, .net 2.0 question. I got 3 tables: Job, Times, Employee. The times table is related to Job and Employee by foreign keys. The Times table is pretty much a table where the employee's time logs are kept for a specific job. Since there was a M:M relationship between Job - Employee, I decided to create a Times table in between, and the primary key of this table should actually be the PK of Job and the PK Employee, but I couldn't figure out how to make a PK consisting of two fields.
Anyhow, my main question is: How to assign an Employee to a specific job in .net? In other words, what's the best way of retrieving the Job_id and Emp_id and sticking them in the Times table? I was doing a form with a drop down for Emp_id and Job_id, but I don't know how to do the inserts... I'm confused and would appreciate any help.THANKS!
View 6 Replies
View Related