Storing Old Values After UPDATE

Mar 15, 1999

When I update a field f1 I should store its previous value in the field f2. How can I achieve this?

View 1 Replies


ADVERTISEMENT

Storing Null Values

Oct 4, 2004

I am retrieving a <NULL> value out of a SQL database, displaying it in a text box, then updating the database with the results of the text box.

I am using the following code to make the insert.

.Parameters("@BodilyInjuryPerson").Value = txtBodilyInjuryPerson.Text

When I have values for the text string, everything runs smoothly. However, when the database originally had a <NULL> or when I want to delete the currently existing value and replace it with a <NULL>, I get an error message stating... "Input string was not in a correct format".

Back in the old days, when I was using Random Access databases, you just inserted a Char(0). But that doesn't work any more.

Could somebody help me. I know there is a magic bullet, I just don't know what it is.

View 2 Replies View Related

Storing Decimal Values

Aug 7, 2007

Hi,

I'm loading millions of rows into a database table. This data contains a lot of dedcimal values of 4 or 6 decimal places somtimes more.

I've found that storing them as floats is inaccurate, and I'm storing as decimals of the appropriate length.

I'm concerned whether this is the right way to do this ?

Can anyone make any suggestions, perhaps an article that I should take a look at ?


Sean

View 2 Replies View Related

Storing Comma Seperated Values

Mar 7, 2008

Hi I have a text field called testing which shows the selection the user has made from a checked list. I want to save the contents of testing to a datadase with coloum varchar and with a comma to seperate the selections. It stores ok but sql queries do not recognise them as comma seperated values. e.g the selection from the vb code produses: Beauty, Fashion, Travel. Sql takes the lot as one. When I test a query say select from table type where Category = beauy it gives nothing. How do I store it so sql would recognise it as seperate enteries.
my vb code is below
Dim msg As StringDim li As ListItem
msg = ""For Each li In CaregoryCheckBoxList.Items
If li.Selected = True Then
'asp has a security default of no accetping html in input fields br is html code so causes error
'msg = msg & "<br>" & li.Text & " selected."
msg = msg & li.Text & "," & " "
End If
Next
Testing.Text = msg

View 10 Replies View Related

Storing Checkbox Values To Database

Mar 19, 2008

Hi i am trying to store the checkbox values on my page to the database, but im stuck on what to do. I have the following code already;protected void Btn_Subscribe_Click(object sender, EventArgs e)
{SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString);
string strSQL = "INSERT INTO Newsletter(emailAddress) VALUES (@emailAddress)";SqlCommand Command = new SqlCommand(strSQL, conn);
Command.Parameters.Add("@emailAddress", SqlDbType.VarChar);Command.Parameters["@emailAddress"].Value = txtEmail.Text;
conn.Open();
Command.ExecuteNonQuery();
conn.Close();
}
How do i now insert the values from my checkbox, this is how i am setting the checkbox;public void Page_Load(object sender, EventArgs e)
{ArrayList values;if(!IsPostBack)
{
//Build array of data to bind to checkboxlistvalues = new ArrayList();
values.Add("Sport");values.Add("Gardening");values.Add("technology");
AlertList.DataSource = values;
AlertList.DataBind();
}
If i am going about it the wrong way please let me know, thanks

View 15 Replies View Related

Problem With Storing Datetime Values In Formview

Jan 20, 2007

Hello all,I'm kind of new to ASP.NET and I've hit my first unsolvable roadblock. I'm trying to create a formview insertcommand that allows me to place the current date into a DateTime field but I continuously get  an Input string was not in a correct format error. I may be using the wrong functions, I'm unsure. I've messed with DateTime.Now.ToString() as well as GETDATE() but I have no idea how to get it to work. I've also tried to switch the variable type of the field to a String type as well as DateTime. I am running visual basic .net with Microsoft SQL Server 2005. Here is my code right now:   Experiencing problems with technology? Just fill out the form below and your problem will be forwarded to the Information Technology department.</em></strong><br />        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TechticketdbConnectionString %>"                            SelectCommand="SELECT [CRDL#] AS column1, [Employee ID] AS Employee_ID, [Problem description] AS Problem_description, [Date submitted] AS Date_submitted, [Ticket number] AS Ticket_number FROM [Tickets]" DeleteCommand="DELETE FROM [Tickets] WHERE [Ticket number] = @Ticket_number" InsertCommand="INSERT INTO [Tickets] ([CRDL#], [Employee ID], [Problem description], [Date submitted]) VALUES (@column1, @Employee_ID, @Problem_description, GETDATE() )" UpdateCommand="UPDATE [Tickets] SET [CRDL#] = @column1, [Employee ID] = @Employee_ID, [Problem description] = @Problem_description, [Date submitted] = @Date_submitted WHERE [Ticket number] = @Ticket_number">            <DeleteParameters>                <asp:Parameter Name="Ticket_number" Type="Int32" />            </DeleteParameters>            <UpdateParameters>                <asp:Parameter Name="column1" Type="Int32" />                <asp:Parameter Name="Employee_ID" Type="Int32" />                <asp:Parameter Name="Problem_description" Type="String" />                <asp:Parameter Name="Date_submitted" Type="String" />                <asp:Parameter Name="Ticket_number" Type="Int32" />            </UpdateParameters>            <InsertParameters>                <asp:Parameter Name="column1" Type="Int32" />                <asp:Parameter Name="Employee_ID" Type="Int32" />                <asp:Parameter Name="Problem_description" Type="String" />                <asp:Parameter Name="Date_submitted" Type="String" />            </InsertParameters>        </asp:SqlDataSource>    I've left out the EditItemTemplate because it isn't going to be used for this form. Here is the InsertItemTemplate:     <InsertItemTemplate>                column1:                <asp:TextBox ID="column1TextBox" runat="server" Text='<%# Bind("column1") %>'>                </asp:TextBox><br />                Employee_ID:                <asp:TextBox ID="Employee_IDTextBox" runat="server" Text='<%# Bind("Employee_ID") %>'>                </asp:TextBox><br />                Problem_description:                <asp:TextBox ID="Problem_descriptionTextBox" runat="server" Text='<%# Bind("Problem_description") %>'>                </asp:TextBox><br />                                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"                    Text="Insert">                </asp:LinkButton>                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"                    Text="Cancel">                </asp:LinkButton>            </InsertItemTemplate>            <ItemTemplate>                column1:                <asp:Label ID="column1Label" runat="server" Text='<%# Bind("column1") %>'></asp:Label><br />                Employee_ID:                <asp:Label ID="Employee_IDLabel" runat="server" Text='<%# Bind("Employee_ID") %>'>                </asp:Label><br />                Problem_description:                <asp:Label ID="Problem_descriptionLabel" runat="server" Text='<%# Bind("Problem_description") %>'>                </asp:Label><br />                Date_submitted:                <asp:Label ID="Date_submittedLabel" runat="server" Text='<%# Bind("Date_submitted") %>'>                </asp:Label><br />                Ticket_number:                <asp:Label ID="Ticket_numberLabel" runat="server" Text='<%# Eval("Ticket_number") %>'>                </asp:Label><br />                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"                    Text="Edit">                </asp:LinkButton>                <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"                    Text="Delete">                </asp:LinkButton>                <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"                    Text="New">                </asp:LinkButton>            </ItemTemplate>        </asp:FormView> I would like to get the value formatted as a DateTime but a String will do just fine if a DateTime variable won't work.     Any help would be greatly appreciated. Thanks! 

View 2 Replies View Related

Storing Multiple Values From Drop Down List

Apr 11, 2012

How can I store multiple selected values (from a dropdown list) in mysql database?

PHP Code:

<form method="post" action="storedetails.php">    Research Interest:<br/>    
<select multiple="yes" size="6" name="interest[]">    
<option id="webt" value="webt">Advanced Web Tech1nologies</option>    
<option id="mobhum" value="mobhum">Mobile and Humanoid Robots</option>    

[code]...

View 5 Replies View Related

Storing Variable Values Whilst Using Cursors

Feb 21, 2007

Hi below is the code I am using.------------------------------------SET NOCOUNT ONDECLARE @emailid varchar(50), @rastype varchar(50),@message varchar(80)declare @allrastypes varchar(200)DECLARE email_cursor CURSOR FORSELECT distinct EmailFROM dbo.tblMaintCustomerORDER BY EmailOPEN email_cursorFETCH NEXT FROM email_cursorINTO @emailidWHILE @@FETCH_STATUS = 0BEGINPRINT ' 'SELECT @message = 'Email Address ' +@emailidPRINT @message-- Declare an inner cursor based-- on vendor_id from the outer cursor.DECLARE rastype_cursor CURSOR FORSELECT distinct [RasType]FROM dbo.tblMaintCase x, dbo.tblMaintCustomer yWHERE x.caseid = y.caseid ANDy.Email = @emailidand RasType is not nullOPEN rastype_cursorFETCH NEXT FROM rastype_cursor INTO @rastypeselect @allrastypes = @allrastypes + ',' + @rastypeIF @@FETCH_STATUS <0PRINT ' <<None>>'WHILE @@FETCH_STATUS = 0BEGINSELECT @message = @rastypePRINT @messageselect @allrastypes = @allrastypes + ',' + @rastypeFETCH NEXT FROM rastype_cursor INTO @rastypeENDCLOSE rastype_cursorDEALLOCATE rastype_cursorinsert into dbo.tblTest values(@emailid,@allrastypes)select @allrastypes = ''FETCH NEXT FROM email_cursorINTO @emailidENDCLOSE email_cursorDEALLOCATE email_cursor--------------------------------------I basically want the value of @allrastypes to accumulate each time itloops through, which is is not doing.The result I get is :Email Address Join Bytes!G5R(for here i want @allrastypes to be 'G5R,')Email Address Join Bytes!G1G3G5O(for here i want @allrastypes to be 'G1,G3,G5O')Can someone helpThanksArchana

View 1 Replies View Related

Storing Values Into Variable From A Distributed Query Result

Mar 25, 2002

Hi.

I am trying to store the column value to a variable from a distributed query.

The query is formed on the fly.

i need to accomplish something like this

declare @id int
declare @columnval varchar(50)
declare @query varchar(1024)
@Query = "select @columnval = Name from server.database.dbo.table where id ="+convert(varchar,@ID)
exec (@query)
print @Columnname


-MAK

View 2 Replies View Related

Inserting Global Variables Storing Values In A Table

Oct 5, 2006

Hi,

I need a resolution of the following issue:

Following SQL is to be inserted in an audit table :

INSERT INTO GLOBAL_VARIABLE_LOAD

([LOAD_ID]

,[LOAD_STATUS]

,[START_TIME]

,[END_TIME])

VALUES

(@P_LOAD_ID

,@P_LOAD_STATUS

,@P_START_TIME

,@P_END_TIME)

@P_LOAD_ID, @P_LOAD_STATUS, @P_START_TIME, @P_END_TIME are the 4 parameters mapped to global variables (At package Level) which store values mapped in a previous SQL Task in my control flow.

Following Error Message is thrown on executing the SQL Task:

Invalid object name 'GLOBAL_VARIABLE_LOAD'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Can anyone guide me as to how should I go about saving values in global variables and inserting them in a table.

Thanks in advance.

Regards,

Aman

View 4 Replies View Related

Storing Comma Separated Values In A Single Column Of A Table

Jul 13, 2007

Hi,
I have a table called geofence. It has a primary key geofence_id. Each geofence consists of a set of latitudes and latitudes.
So I defined two columns latitude and longitude and their type is varchar. I want to store all latitude/longitude values as a comma separated values in latitude/longitude columns
So in general how do people implement these types of requirements in relational databases?


--Subba

View 11 Replies View Related

The Best Method Of Storing Multiple Values For A Single User Criteria In The Database ?

Mar 31, 2008

Let's say you had a User table and one of the fields was called Deceased.  It's a simple closed-ended question, so a bit value could be used to satisfy the field, if the person is dead or alive.  Let's say another field is called EyeColor.  A person can have only one eye color and thus one answer should be stored in this value, so this is easy as well.
Now, let's say I want to store all the languages that a specific user can speak.  This isn't as easy as the previous examples since it's not a yes or no or a single-value answer.  I haven't had much experience with working with databases so I've come up with two possible ways with my crude knowledge hehe.
In terms of inputting the multi-answer values, I suppose I could use a multiple-selection listbox, cascading dropdowns, etc.  Now, here are the 2 solutions that came to mind.....
1) Make a field called LanguagesSpoken in the User table.  When I process the selections the user makes on the languages he knows, I can then insert into the LanguagesSpoken field a string "English, Spanish, Czech" or IDs corresponding to the languages like "1, 5, 12" (these IDs would be referenced from a separate table I guess).  I would use commas so that later on, when I need to display a user's profile and show the user's languages, I can retrieve that long string from the LanguagesSpoken field, and parse the languages with the commas I've used.  Using commas would just be a convention I use so I would know how to parse (I could have used "." or "|" or anything else I guess) the data.
2) Forget about the LanguagesSpoken field in the User table altogether, and just make a LanguagesSpoken table.  A simple implementation would have 3 fields (primary key, userId, languageId).  A row would associate a user with a language.  So I would issue a query like "SELECT * FROM LanguagesSpoken WHERE userId=5" (where userId=5 is some user).  Using this method would free me from having to store a string with delimited values into the User table and then to parse data when I need them.  However, I'm not sure how efficient this method would be if the LanguagesSpoken table grows really large since the userIds would NOT be contiguous, the search might take a long time.  I guess I would index the userId field in the LanguagesSpoken table for quicker access?
OR, I may be going about this the wrong way and I'm way out on left field with these 2 solutions.  Is there a better way other than those 2 methods?
I haven't work extensively with databases and I'm just familiar with the basics.  I'm just trying to find out the best-practice implementation for this type of situation.  I'm sure in the real world, situations like this is very common and I wonder how the professionals code this.
Thanks in advance.

View 3 Replies View Related

How To Correctly Update A Table Which Values Can Be Either Inserted/updated/deleted On Update?

Feb 16, 2006

Hi SQL fans,I realized that I often encounter the same situation in a relationdatabase context, where I really don't know what to do. Here is anexample, where I have 2 tables as follow:__________________________________________ | PortfolioTitle|| Portfolio |+----------------------------------------++-----------------------------+ | tfolio_id (int)|| folio_id (int) |<<-PK----FK--| tfolio_idfolio (int)|| folio_name (varchar) | | tfolio_idtitle (int)|--FK----PK->>[ Titles]+-----------------------------+ | tfolio_weight(decimal(6,5)) |+-----------------------------------------+Note that I also have a "Titles" tables (hence the tfolio_idtitlelink).My problem is : When I update a portfolio, I must update all theassociated titles in it. That means that titles can be either removedfrom the portfolio (a folio does not support the title anymore), addedto it (a new title is supported by the folio) or simply updated (atitle stays in the portfolio, but has its weight changed)For example, if the portfolio #2 would contain :[ PortfolioTitle ]id | idFolio | idTitre | poids1 2 1 102 2 2 203 2 3 30and I must update the PortfolioTitle based on these values :idFolio | idTitre | poids2 2 202 3 352 4 40then I should1 ) remove the title #1 from the folio by deleting its entry in thePortfolioTitle table2 ) update the title #2 (weight from 30 to 35)3 ) add the title #4 to the folioFor now, the only way I've found to do this is delete all the entriesof the related folio (e.g.: DELETE TitrePortefeuille WHERE idFolio =2), and then insert new values for each entry based on the new givenvalues.Is there a way to better manage this by detecting which value has to beinserted/updated/deleted?And this applies to many situation :(If you need other examples, I can give you.thanks a lot!ibiza

View 8 Replies View Related

Which Is Better? Storing Data In The Database OR Storing It In The File System

Dec 29, 2006

Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?    

View 6 Replies View Related

Transact SQL :: Update One Table Based On Another Table Values For Multiple Values

Apr 26, 2015

I have two tables  A(uname,address,full_name) and B(uname,full_name). I want to update table A for all matching case of uname in table B. 

View 5 Replies View Related

T-SQL (SS2K8) :: Stored Procedure To Truncate And Insert Values In Table 1 And Update And Insert Values In Table 2

Apr 30, 2015

table2 is intially populated (basically this will serve as historical table for view); temptable and table2 will are similar except that table2 has two extra columns which are insertdt and updatedt

process:
1. get data from an existing view and insert in temptable
2. truncate/delete contents of table1
3. insert data in table1 by comparing temptable vs table2 (values that exists in temptable but not in table2 will be inserted)
4. insert data in table2 which are not yet present (comparing ID in t2 and temptable)
5. UPDATE table2 whose field/column VALUE is not equal with temptable. (meaning UNMATCHED VALUE)

* for #5 if a value from table2 (historical table) has changed compared to temptable (new result of view) this must be updated as well as the updateddt field value.

View 2 Replies View Related

Update Values...

Nov 15, 2006

instead of insert into command
  sqlcom.CommandText = "insert into Approve_Overtime(syainNo,ninka_nen_from,ninka_gatsu_from)values(@syainNo,@ninka_nen_from,@ninka_gatsu_from)
 
how can i change it using update command?
 
thnx
 

View 137 Replies View Related

Can't Update Values

Nov 27, 2006

Hi Guys
I already searched for one day and didn't find any solution. Unfortunately I can't update my dataset. It works when I remove the string "WHERE ID = ?" in the UpdateCommand but then it updates all the records. I think it must be something obvious which I just don't see:(There are two tables; tblArtists and tblCountries which are connected together with a Inner Join. Now,  I need the ID from the table Artists to update the dataset. How can I get it?Here the code:....SelectCommand="SELECT tblArtists.ID AS IDArtists, tblArtists.ArtistName, tblArtists.FirstName, tblArtists.LastName, tblArtists.Address, tblArtists.PLZ, tblArtists.City, tblArtists.Region, tblArtists.Country_ID, tblArtists.MusicStyles, tblArtists.HomeDJ, tblArtists.Active, tblArtists.CDate, tblArtists.Description, tblCountries.ID AS IDCountries, tblCountries.Country, tblArtists.Producer, tblArtists.Picture, tblArtists.Homepage, tblArtists.Phonenumber, tblArtists.eMail FROM (tblCountries INNER JOIN tblArtists ON tblCountries.ID = tblArtists.Country_ID) WHERE (tblArtists.Active = ?) AND (tblArtists.HomeDJ = ?) AND (tblArtists.Producer = ?)"        UpdateCommand="UPDATE tblArtists SET ArtistName = ?, FirstName = ?, LastName = ?, Address = ?, PLZ = ?, City = ?, Region = ?, Country_ID = ?, MusicStyles = ?, HomeDJ = ?, Active = ?, Description = ?, Producer = ?, Picture = ?, Homepage = ?, Phonenumber = ?, eMail = ? WHERE ID = ?">        <SelectParameters>            <asp:ControlParameter ControlID="activeRadioButton" Name="Active" PropertyName="Checked" Type="Boolean"/>            <asp:ControlParameter ControlID="homedjRadioButton" Name="HomeDJ" PropertyName="Checked" Type="Boolean"/>            <asp:ControlParameter ControlID="producerRadioButton" Name="Producer" PropertyName="Checked" Type="Boolean"/>        </SelectParameters>        <UpdateParameters>            <asp:Parameter Name="ArtistName" Type="String" Size="254" />            <asp:Parameter Name="FirstName" Type="String" Size="254" />                        <asp:Parameter Name="LastName" Type="String" Size="254" />                        <asp:Parameter Name="Address" Type="String" Size="254" />            <asp:Parameter Name="PLZ" Type="String" Size="254" />            <asp:Parameter Name="City" Type="String" Size="254" />            <asp:Parameter Name="Region" Type="String" Size="254" />            <asp:Parameter Name="Country_ID" />            <asp:Parameter Name="MusicStyles" Type="String" Size="254" />            <asp:Parameter Name="HomeDJ" Type="Boolean" />            <asp:Parameter Name="Active" Type="Boolean" />            <asp:Parameter Name="Description" Type="String" />            <asp:Parameter Name="Producer" Type="Boolean" />            <asp:Parameter Name="Picture" Type="String" Size="254" />            <asp:Parameter Name="Homepage" Type="String" Size="254" />            <asp:Parameter Name="Phonenumber" Type="String" Size="50" />            <asp:Parameter Name="eMail" Type="String" Size="50" />            <asp:Parameter Name="original_IDArtists" Type="Int32" />    </UpdateParameters>    </asp:SqlDataSource>
GreetingsPat

View 1 Replies View Related

Update All Row From A With Values From B

Apr 18, 2014

IDVALUE1VALUE2
1|a|12
2|v|3
3|c|4
4|g|12

B
IDIDAVALUE
1|1|12
2|1|34
3|2|17
4|3|4
5|1|22
6|3|1

I want to update A with values from b , so the value2 from a= value from b but only with latest corresponding data based on b.id so after updtate a looks like:

IDVALUE1VALUE2
1 |a |22 couse max id from B with ida=1 is 5 and so the value is 22, so A.value2=22
2 |v |17 couse max id from B with ida=2 is 3 and so the value is 17so A.value2=22
3 |c | 1 couse max id from B with ida=3 is 6 and so the value is 1 so A.value2=1
4 |g |12 couse there is no ida=4 in B

View 1 Replies View Related

Cannot Update All The Values Of Query

Mar 15, 2007

I have faced a situation that when i try to update a page. Some values can be updated while some cannot. I try to print the executed SQL query and get the following1 "UPDATE orders SET
2 cust_id=15,po_code='PO20060610',
3 po_amt=10000.0000,
4 add_charges=0,
5 commission='eeeeeee',
6 lab_charges=0,
7 fty_dis=0,
8 pay_trm='adasds',
9 cust_dis=0,
10 trade_trm_desc='',
11 curr_rate=1,
12 ship_expense=0,
13 shipmark='eng ship mard new2',
14 sidemark='Eng Side Mark new333'
15 ,inner_box='Eng Inner Box new333',
16 confirmation='rend confirmation2',
17 contract='end contact23',
18 internal_remark='testing testing 26/6/2007 333',
19 rec_curr_rate=0,rec_amt=0,shipmark_attach='',
20 sidemark_attach='',inner_box_attach='',
21 ord_type=1,status=2,ord_confirm_code='',
22 commission_type=1,sidemark_lang='English',
23 curr_code='HKD',unit_code='PCS',
24 trade_trm='FOB Hong Kong',rec_curr='USD',
25 ord_date='2006/06/10', po_date='01/01/2007',exp_delivery_date='01/01/2007',
26 act_delivery_date='01/01/2007', pay_start_date='10/10/06',pay_end_date='10/10/06',upd_time='2007/03/15 15:41:14' WHERE ord_id=292;Set @ord_id=292;"

 
The fields sidemark, inner_box, internal_remark cannot update, while others can.
I think it's really strange.... since i have no idea why some can be updated while some others and the SQL seems to me is correct.
 Please give me some advices on solving this.
Thank you.

View 4 Replies View Related

Update Table From Values In Another..

Jan 12, 2004

Hi ya,

I need to update two columns in one table from information in another table..

Table1

ID, UserID

Table2

ID, NewUserID

How can I write this update statment?

Thanks!

View 2 Replies View Related

Update With Multiple Values

Apr 22, 2008

I have a table say #temp1 with coulmn Id and Description
and I do have another table #temp2 with column id and Projectdescription
but in #temp2 there could be more then one value against one id
like the data in #temp2 is look like

id Projectdescription
1 Computer project
1 update in computer project
1 another update in computer
2 Physics project
2 another update

but #temp1 has only one accurance of id
and data initially looks like
id Description
1 NUll
2 NUll
and I would like to update this table description from #temp2 Projectdescription column so that
data in #temp1 table look like after update

id Description
1 Computer project,update in computer project, another update in computer

2 Physics project, another update

I mean I would like to have concatination form of Projectdescription in description column against specific ID
I can achieve this by using UDF but i dont want to use that I just want to do it by update statement not even by using cursor

View 8 Replies View Related

Update Database A With Values From B?

Jan 10, 2006

I have two databases, database A and database B

Both have an identical table called "Codes" containing billing numbers and prices.

Database B is one I use for testing, and is out of date. Is there an easy way to load the values from Table_A.codes into Table_B.codes?

I know how to do an update from one table to another within the same database, but am clueless how to do it when the data reside in separate databases.

Thanks in advance.

View 10 Replies View Related

How To Update Values Using Where Conditions

Dec 27, 2007

Hi All,

I have my table structure as Follows

S.NO INT
S.NAME VARCHAR(50)

now i want to update values where S.NO=10.

How is this possible to writ query.

As per my knowledge sql won't allow dot as in column name in where condition.

Can any one please advice on this.
This is Priority one.

Thanks in advance.

View 3 Replies View Related

How To Update All The Values Of Column

Mar 21, 2008

hi, i have column salary in my table emp.
my column values are as follows:

salary:
20000
30000
40000
50000

so i need to update this column values in a single update statement.
so my values as follows:

salary:
10000
10000
10000
10000
so please give me example query to update this please

View 4 Replies View Related

UPDATE Values From An Array?

Jul 20, 2005

Hi there...Is it possible to write an UPDATE or INSERT query, where the new value comesfrom an array? For example:UPDATE table_a SET column_x = [@array1]WHERE column_y = [@array2];It's a query (for argument's sake called query1) in an Access database,which I'm accessing as a stored procedure through PHP, so I would run somephp code that looked possibly like this:$array1 = array("a","b","c","d");$array2 = array(1,2,3,4);$str_sql = "exec query1 $array1, $array2";my_run_query_function($str_sql);But is it possible? The information I can find about it seems to say that ithas to be an array created inside the query, but if it's a stored procedure,this isn't possible, is it?Hope someone can help...Plankmeister.

View 2 Replies View Related

Cannot Update Records That Contain NULL Values!!!

Oct 19, 2006

Hi,  I am trying to use a formView with an update button to update individual records in an sql database. (when i click update it doesnt perform the update and just refreshes the page. ) One of the fields in my records is a NULL - this is also one of the fields that i need to update. When i manually go into the database and enter some data, and then go back to my form, it updates fine, but as soon as i delete the data from the field, it returns to NULL and im back to square one. Any Ideas on how to get around this problem?THanks

View 4 Replies View Related

New Values Ignored In SQL Server UPDATE Query

Nov 4, 2004

I am new to both ASP.net and this forum. I have seen some posts close to this, but none address this problem.

I have a SQL Server database on JOHN1 called 'siu_log' with a table called 'siu_log'. It has two fields: Scenarios char[20] and Machines char[20].

I have been adapting code from Build Your Own ASP.NET Website in C# & VB.NET by Zac Ruvalcaba to learn the language. Much of what you will see is his work adapted for my use.

First, the html:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="SIU_Assign.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>SIU Interface Scenario Assignments</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:datagrid id="scenariosDataGrid" runat="server" CellPadding="4" AutoGenerateColumns="False"
OnUpdateCommand="dg_Update" OnCancelCommand="dg_Cancel" OnEditCommand="dg_Edit" DataKeyField="Scenarios">
<ItemStyle BackColor="#00DDDD" ForeColor="#000000" />
<HeaderStyle BackColor="#003366" ForeColor="#FFFFFF" />
<Columns>
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update" />
<asp:BoundColumn DataField="Scenarios" HeaderText="Scenario" ReadOnly="True" />
<asp:TemplateColumn>
<HeaderTemplate>
Machine
</HeaderTemplate>
<ItemTemplate>
<%# Container.DataItem("Machines") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtMachine" Runat=server Text='<%# Container.DataItem("Machines") %>' />
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
<asp:Label id="resultLabel" runat="server"></asp:Label></form>
</body>
</HTML>


Then the CodeBehind:

Sub dg_Update(ByVal s As Object, ByVal e As DataGridCommandEventArgs)
Dim strMachineName, strScenarioName As String
Dim intResult As Integer
strScenarioName = Trim(scenariosDataGrid.DataKeys(e.Item.ItemIndex))
strMachineName = CType(e.Item.FindControl("txtMachine"), TextBox).Text
cmd = New SqlCommand("UPDATE siu_log SET Machines=@Machine " & _
"WHERE Scenarios=@Scenario", conn)
cmd.Parameters.Add("@Machine", strMachineName)
cmd.Parameters.Add("@Scenario", strScenarioName)
conn.Open()
intResult = cmd.ExecuteNonQuery()
resultLabel.Text = "The result was " & intResult & "."
conn.Close()
scenariosDataGrid.EditItemIndex = -1
BindData()
End Sub


The problem is the strMachineName variable always contains the previous contents of the text box -- not the new one. This makes the UPDATE query just push the old data back into the table.

Any suggestions?

Thanks!
John

View 5 Replies View Related

Join Two Tables And Update Values In One

Feb 21, 2012

I have two tables A and b

A
projectID Setid value
301 1 abc
301 2 xyz
302 4 def
..... .... ..

B
SettingsId Setvalue
1 ter
2 yet
4 44
... ....

I want to update all the Setid of table A with that of values from table b. How can i do this?

View 7 Replies View Related

How To Update Values From The User Input?

Jun 2, 2008

Hi I have a table(tblA) as follows

Col1--------------col2---------col3-----col4
London------------1131---------299------Barking
Didicot-----------3451---------429------Dansdon
Barking/ASton-----1131---------345------Singleton
Vander/ADon/cam---3907---------299------derby
Null or Blank ---1131---------423------Addington

Expecting the Data should display look like below

London------------1131---------299------Barking
Didicot-----------3451---------429------Dansdon
Barking/ASton-----1131---------345------Singleton
Vander/ADon/cam---3907---------299------derby

But when user change the col2 value (1131) to 113999, this should be changed to all values where col2 is 1131. Please Help

View 2 Replies View Related

Update Query For Similar Values

Nov 8, 2013

I have a grid like this and when I change Designation value of Name X from PA to PAT, this change should reflect to Sathish Designation too. Changing similar values should reflect all over the grid. Like update database on change of value of similar kind.

By far I use this query to update the grid. So a where clause should be used now to update the grid to fit this scenario.

("UPDATE AppInvent_Test SET Name = @Name, Designation = @Designation, City = @City WHERE EmpID = @EmpID");

EmpID Name Designation City
21 X PA Chn
2 Sathish PA Chn
3 Shiva A Cbe
17 Venkat M Hyd
22 Y SM Cbe
18 Vignesh SA Hyd

Table:
CREATE TABLE [dbo].[AppInvent_Test](
[EmpID] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](100) NULL,
[Designation] [varchar](100) NULL,

[Code] ....

View 4 Replies View Related

Update Query With And Without Null Values

Nov 18, 2013

I have a grid with checkbox, where users can select multiple rows and edit at the same time and save it to the DB. Now I have used a Footer Template with textbox in the gridview. So if I want to put similar data's for some particular rows at the same time in the grid, I select the multiple rows and try to put values in the footer template textbox and when I click on save, it saves successfully.

UPDATE QUERY:
"UPDATE [Test] SET [Name]='" + Name + "',[Designation]= '" + Designation + "', [City]= '" + City + "' WHERE EmpID='" + EmpID + "'";

Now here is the challenge, but even when I enter null values in the footer template textbox it has to save with the old values of the rows and not null values. I tried it and couldn't make it happen. So anything like putting the case for each column and mentioning like if null accept the old value and not null accept new value.

View 5 Replies View Related

Transact SQL :: Update Null Values

Jun 23, 2015

i want to display the max Date in place of NULL when Indicator is "1"

INPUT

Emp  Num
Date
Indicator
1
Null
1

[code]....

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved