Urgent: Replacing Data In A Column

Oct 9, 2006

hi.

I have to update a column with new data. I have to replace the values that lay with a certain range. for example

my table has a column called ENI_KEYVALUE1, I have to update the data in this column only where the ENI_KEYVALUE1 is between P6_00001 and P6_00240. The values have to be replaced with values listed sequencially in an excel spreadsheet.

how do I do this???

thanks in advance

View 2 Replies


ADVERTISEMENT

Urgent-Replacing A List Of Characters From A Column

Nov 13, 2001

Hi,
this is my second attempt to get an answer to this question.
We want to strip our firstName column and lastname column of any punctuation that might be present.
What's the best of doing that?
Is my only choice to write a nested REPLACE for each character we want replaced (which will end up being very very long) or is there another way.
thanks
Zoey

View 2 Replies View Related

TEXT Data Type Column: Replacing Chars : Why Isn't This Routine Working?

Jul 20, 2005

Hi;I am trying to write a rountine ( below ) that will go into a colum oftext data type ( fae.pmcommnt ) locate the word "to" and replace it.I have the routine below. I get no error messages, but it also seemsto do nothing :).Any clues would be greatly appreciated.ThanksSteve================================================== =============declare @ptrP intSELECT @ptrP = PATINDEX('%to%', pmcommnt)from fae where projid ='00013'declare @ptrPC binary(16)select @ptrPC = TEXTPTR(pmcommnt)from faeif( TEXTVALID ('fae.pmcommnt', @ptrPC ) > 0 )print 'works'print @ptrPUPDATETEXT fae.pmcommnt @ptrPC @ptrP 2 'JJ'select projid, pmcommnt from fae

View 2 Replies View Related

Replacing Value In Column?

Nov 20, 2013

I want to replace the value in a column with the content from listbox.

I have wrote the code like,

Dim i as Integer
dim sql as string
For i = 0 to Customerslist1.ListCount-1
sql = "UPDATE master (gstl) VALUES(" +chrb(34)+Customerslist1.Cell(i,8)+chrb(34)+")"
app.Gudangstock.SQLExecute(sql)
app.Gudangstock.commit
next
msgbox"insert ok"
UpdateCustomerList1

but no error found and the sql command is not executing.

View 5 Replies View Related

Replacing Column Value

Dec 3, 2007

Hi Guys,

I am faced with a problem that is giving me headaches. I have t1, t2 and t3. I t1 I have students that have a reference to t2 which are the schools they belong to. The problem arises when I see that there is redundancy in t2. There more records for the same schools. This was posible in giving the same school (postcode and name make it the same school) a different ID. In t3 I removed these redundant schools by using fuzzy grouping.

My problem is I want to ensure that the students are put using the schools from t3 instead of t2. So what I need to do is is to replace the redundant id from t2 with the correct id from t3.

Please help. Thans in advance

View 3 Replies View Related

Replacing A Column With A Foreign Key

Dec 24, 2005

In an *existing* database, how would you remove the City column in the
Employees table, and put in the CityID key column from the Cities table
?

View 2 Replies View Related

Replacing Some Names In Column But Not All

Dec 2, 2013

I have a SQL table with 5000 rows in it. Some of the other SQL columns have different values but if I wanted to swap say 500 of the rows would it be something like

UPDATE Coupins
SET Name='test1,test2,test3'
WHERE Name='test4,test5,test6';

I need basically to swap the Name value of these without affecting any other values.

View 4 Replies View Related

Replacing First Letter Only In Column

May 17, 2006

Hello. We have a list of 1000+ sku numbers. 90% of them start with u. I need to replace the u with T.

Concerns:
It has to only replace the first letter, if there are other "u"s in the sku, they need to remain.
Not all skus start with u, those that don't should remain the same.

I have searched and searched because I'm sure someone has requested the exact same thing but I can't find anything that is identical.

I have this so far but I know its not correct:
set sku = replace(left(sku,1),'u',right(rtrim(sku),1)+
'T')

Can someone help lead me down the right path?

Thanks in advance!!!

View 4 Replies View Related

Integration Services :: SSIS Package - Replacing Null Values In One Column With Values From Another Column

Sep 3, 2015

I have an SSIS package that imports data from an Excel file, replaces any value in Excel that reads "NULL" to "", then writes the data to a couple of databases.

What I have discovered today, is I have two columns of dates, an admit date and discharge date column, and what I need to do is anywhere I have a null value in the discharge date column, I have to replace it with the value in the admit date column. 

I have searched around online and tried a few things using the Replace funtion in Derived columns but no dice so far. 

View 3 Replies View Related

Derived Shape - Replacing A Column With Itself.

Apr 27, 2006



Hi there,

I have a derived column shape in which I replace a column with an expression.

The expression is an IF statement - a true result sets a value for the column and a false result just uses the existing value of the column (ie it replaces it with itself)

Like this.

ColumnName DerivedColumn Expression

ColumnA Replace 'ColumnA' ColumnB != ColumnC ? "y" : ColumnA



But whenever, the condition is NOT met, ColumnA is set to NULL!!!!

Does this mean that the column value is deleted before the Expression is applied?

If this is how it is meant to work, then does anyone have a way of doing what I want to do without creating extra columns in the dataset??

Cheers.




View 13 Replies View Related

Replacing Text In A Column For All Rows In The Table?

Oct 24, 2012

I have a column like this:

Table: User
name, field1
Jack 1000|1001|1003
Berg 2000|1001|2004
Paul 1001|1000
Jane 1001

Now, I would like to replace all "1001" with nothing, and also remove the "|"-separator behind 1001 if it exists, basically removing both "1001" and "1001|", so the resulting table looks like this:

name, field1
Jack 1000|1003
Berg 2000|2004
Paul 1000
Jane

My tries, been plenty, but here are some:

Code:
UPDATE UserTable
SET field1 = REPLACE(field1, '1001', '')
UPDATE UserTable
SET field1 = REPLACE(field1, '1001|', '')

But the above queries replaces field1 only if the whole field matches '1001' or '1001|'...

The above queries do work, just like I want them to. I just happened to write them in this order on this post... did not do a copy of the actual query.

View 1 Replies View Related

SQL 2012 :: Replacing Column Names With Values

Nov 4, 2015

I have a field in a table that contains a different formula (varchar(1000)) for each record. It's along the lines of something like this, although each formula is different: ([ColumnA] - [ColumnB])/([ColumnC] - [ColumnD]). I plug that into a dynamic SQL statement so that it can get executed in a select statement.

Due to the variations of the formulas, checking for Divide by Zero, etc, we want to move this to a .NET method. We'd like to replace "ColumnA" and "ColumnB", etc., with the actual values so that we're passing something like (5-3)/(6-2). I haven't been able to figure out a way to do this without actually executing it. We don't want to pass the solution, but the equation filled with the actual values rather than the column names.

View 3 Replies View Related

Replacing A Portion Of Text String In Column

Jul 20, 2005

I need to replace a portion of a url in a column as a result ofchanging servers. Is there a SELECT/REPLACE/UPDATE combination querythat can do this. The table has close to a thousand entries and wouldbe nice if a query can be set to do this. Tried the REPLACE examplein the BOOKS ONLINE but it creates syntax error, apparently because itdoes not like the characters in the url and/or wildcards. I don't needto replace the entire url, only the portion before ".com". Thanks inanticipation of your help.Pradip Sagdeo

View 3 Replies View Related

(Urgent)How Can I Specify The Excel File's Column To Import Data As Varchar Instead Of Float

Sep 10, 2007



Hi,
I have a excel file which i want to import the data to sql server... The sql server Data type for that particular column is

varchar and it has a contraint too like the data should be in this fashion 00000-0000 or 00000...

but when i try to import the data from the excel to sql server... 08545 just becomes 8545 (cause excel is treating it as a float) and so my insert fails...

what can i do to rectify the problem...

regards
Karen

View 8 Replies View Related

Help - Replacing Data In Tables

Sep 4, 2005

Need to update data from one table with data from another table.

I'm very, very new to MS SQL Server

I have the following two tables.
First table
tblEmp
Field - empno

Second table
tbltemp
Field - oldempno
Field - newempno

tblemp.empno = tbltemp.oldemno

I need to replace the data in tblEmp.empno with tbltemp.newempno where tblemp.empno = tbltemp.oldempo.

Thank you.

View 1 Replies View Related

Replacing Data From SELECT/WHERE

Jun 26, 2001

Hi, and tanks for taking time to read this question. I am still a novice at SQL (Server 2000)programming.

Is there a way to replace the contents of a column of a table derivied from SELECT and WHERE statements?

For example,

SELECT * FROM table1
WHERE column1 = 'text'

and replace 'text' with say, 'newtext'

Any help would be appreciated!

Regards,

Chandran

View 5 Replies View Related

Replacing Data By Select On Other Tables

Feb 14, 2008

i have following problem: i need to import csv data into a ole db destination. on colum in the csv file is a 'external' customer number but in the destination table there must be an 'internal' customer number. of course there's a table where the mappings between external and internal customer number are defined, but this tables is located on another server. So i have no idea how to solve this problem ... maybe because i'm pretty new to ssis

thanks a lot

View 13 Replies View Related

Something/Someone Compromising Database -- Replacing Data With Javascript

May 19, 2008



Has anyone ever seen this code (I put the script tags in brackets so it would not get embedded in forum page)?



[script src=http://www.qiqigm.com/m.js][/script]



We have a number of MSDE 2000 databases running on a Windows 2003 SBS. These databases feed information to their respective websites. One of our databases (and on this one only) something or someone is somehow overwriting the text and varchar fields in all of the tables in the database and replacing it with the above or similar javascript. I've been a database developer and administrator for a long time and I have not a clue how this is being accomplished. When this code replaces our data, what ends up happening is 1) the virus detectors start going off the chart if you go to the site and 2) the script somehow appears to attempt to mimic the site its taken over.



When I do a search on qiqigm to see if anybody has had this problem before, really the results you get are pages and pages of sites that appear to be infected directly with the same bogus javascript code...and not a word about what it is or where its coming from. In our case, and it appears many others by looking, replacing the product description or title description or ordering information in the database causes the script to be written to the browser where otherwise the product/order information would be. This causes the script to run when the page is loaded. Since it overwrites the data in all fields in all tables, it assures itself that it will get displayed no matter what a user attempts to do on the site.



On this database, the only user that has access to the database is the IUSR_<domainadmin> account.



I restored this particular database a couple of days ago to an uninfected backup. I had done this before, but the script would eventually manifest itself again at some point. This time I have removed the ability to get to the product pages for now until we figure out the problem. This appears to be keeping the beast at bay. So far (2+ days), the database has remained in tact.



Anybody got a clue as to what it is I'm up against?





TIA,





Ray Jefferson

Database Whiz Consulting

2657 Windmill Pkwy #158

Henderson, NV 89074702-376-6955

View 8 Replies View Related

SQL Server 2008 :: Masking / Replacing Sensitive Data In Database?

Oct 8, 2015

when prod db is restored in test server, i have to hide/replace sensitive fields (name, phone etc)Is it doable in SQL 2008 and SQL 2012?

View 5 Replies View Related

T-SQL (SS2K8) :: Pivot Table - How To Get Right Count In First Data Mining Replacing Zeros

Mar 24, 2014

I run this code:

SELECT
Gruppo_Assegnatario,
[100] as stato1, [101] as stato2, [102] as stato3
FROM
(
select

[Code] ...

That extracts only zeros (columns "stato1", "stato2", "stato3"):

Gruppo_Assegnatariostato1stato2stato3
SDB_BE Vita Antiriciclaggio0 00
SDB_BE Vita Assistenza clienti000
SDB_BE Vita Emissione000
SDB_BE Vita Gestione Rendite000
SDB_BE Vita Liquidazioni000

[Code] ....

Unlike the "SourceTable":

select
CASE_ID_,
Stato,
Gruppo_Assegnatario
FROM TicketInevasiPerGruppoEStato
extracts

CASE_ID_ Stato Gruppo_Assegnatario
HD0000003736734 AssegnatoSDB_GBS Variazione
HD0000003736739 AssegnatoSDB_GBS Variazione
HD0000003736743 AssegnatoSDB_GBS Variazione
HD0000003736783 AssegnatoSDB_GBS Variazione
HD0000003736806 SospesoSDB_BE Vita Selezione

[Code] ....

How can I get the right count in the first data mining replacing the zeros (columns "stato1", "stato2", "stato3")?

View 5 Replies View Related

Replacing Active X/VBscript Used In SQL2000 Data Transformations To SQL2005 SSIS

Nov 1, 2006

Hi

I am new to SSIS and have the following problem. I used the following script to clear data in columns of any CR/LF/Commas and char(0)'s. Can I just transfer this to SSIS and how exactly do I do that? Any help or advice would help.

Function Main()

Dim x

For x=1 to DTSSource.count

If Isnull(DTSSource(x)) = False Then

DTSDestination(x) = replace(replace(replace(Replace(DTSSource(x) , chr(13),""),chr(10),""),chr(0),""),","," ")

Else

DTSDestination(x) = DTSSource(x)

End If

Next

Main = DTSTransformStat_OK


End Function

Andre

View 8 Replies View Related

Copy View And User Defined Functions To Another Database Without Replacing Data

Mar 5, 2008

I work on a copy of SQL Server Express on my desktop. After modifying and creating views and user defined functions, I would like to copy and paste them into the working database. Is there a method programmatically of doing this or must I copy and paste the t-sql language from the existing view to the new database--then save the new view on the working database?

View 6 Replies View Related

Checking Contents Of Column And Replacing Contents If First Character Is A Letter

Jun 25, 2007

Hi All,I have come up against a wall which i cannot get over.I have an sql db where the date column is set as a varchar (i know, should have used datetime but this was done before my time and i've got to work with what is there). The majority of values are in the format dd/mm/yyyy. However, some values contain the word 'various'.I'm attempting to compare the date chosen on a c# .net page with the values in the db and also return all the 'various' values as well.I have accomplished casting the varchar to a datetime and then comparing to the selected date on the .net page. However, it errors when it comes across the 'various' entrant.Is there anyway to carry out a select statement comparing the start_date values in the db to the selected date on the .net page and also pull out all 'various' entrants at the same time without it erroring? i thought about replacing the 'various' to a date like '01/01/2010' so it doesn't stumble over the none recognised format, but am unsure of how to do it.This is how far i have got: casting the varchar column to datetime and comparing.  SELECT * FROM table1 WHERE Cast(SUBSTRING(Start_Date,4,2) + '/' + SUBSTRING(Start_Date,1,2) + '/' +SUBSTRING(Start_Date,7,4) as datetime)  '" + date + "'"Many thanks in advance! 

View 7 Replies View Related

Adding Column !! Please Help .Urgent

Mar 26, 2002

Hello Everybody

We have a SQL Server 6.5 with SP 5a . I want to add an additional column in one of the tables of a database .
Since i don't have much experience on SQL 6.5 , i need your precious help in resolving this case .
Can somebody help me in this regard in a detail step wise manner ? Enterprise manager does not have facility to add new columns to an existing table in SQL 6.5 .
I want to add a Column called 'DM ' with datatype as 'bit' with size as 1 and as non nullable .
Any kind of help will be very precious to me .

Thank you all in advance.

Regards
Rita.

View 5 Replies View Related

Autonumber Column, Urgent!!

Aug 14, 2001

Hi all,
I'm writing a procedure and have a temporary table. One of the column in the temporary table must have an autonumber. How should I define this column when creating the temporary table!
Thank you

View 4 Replies View Related

Urgent Help! - How To Get The Column Selection?

Oct 4, 2004

suppose i have a table penalties with
ticket_number, ticket_start_date datetime, ticket_end_date datetime

There are many records of same ticket_number.example:
ticket_number ticket_start_date ticket_end_date
75 2/1/03 3/2/03
75 2/4/03 5/4/03

34 2/1/03 3/3/04
34 3/4/04 3/3/05


I want to write a query which will:
1. select the ticket_number which is not active as of today
in case of ticket_number 75 it is closed so I want to print it in report

in case of 34 it was closed but now opened, so i don't want in my report.

Could anybody suggest a query how to do it?

I was trying with stored procedure and cursor :


-------------------------------------
CREATE PROCEDURE simpleTest

AS

declare @Today datetime
set @Today = '10/04/2004'
declare @colA varchar(38)
declare @colB datetime
declare @colC datetime
declare @myCursor CURSOR

set @myCursor = CURSOR FAST_FORWARD
for
select distinct ticket_number, ticket_start_date, ticket_end_date
from penalties
where ticket_end_date <= @Today

open @myCursor
fetch next from @myCursor
into @colA, @colB, @colC

while @@fetch_status=0
begin
print @colA
print @colB
print @colC
fetch next from @myCursor
into @colA, @colB, @colC
end

close @myCursor
deallocate @myCursor



GO

-- =============================================
-- example to execute the store procedure
-- =============================================
EXECUTE simpleTest
GO
-------------

however this gives closed tickets but multiple records. I want only the last record details of the ticket_number.
I tried last(ticket_number) in my query, but it doesn't affect.
Please suggest! thanks.
I am using MS SQL server.

View 9 Replies View Related

(Urgent) How Do I Add Column Next To Each Other In A Matrix...

Nov 26, 2007



Hi..
I want to dynamically add column to a matrix.. this is what i have done so far...

1) Have a matrix control on my report...
2) added columns to it.. i want to may be add around 20 columns.. but at a given time there may not be more than 6 -10 columns. But if i add another column to the matrix it put it below the first column like this

Fields!NDesc1.value
Fields!NDesc2.Value

but i want to display it like this

Fields!NDesc1.value Fields!NDesc2.Value

How can i do it..
Can i have some step by step directions to do it...

any help will be appreciated.

Regards
Karen

View 12 Replies View Related

T-SQL (SS2K8) :: Use Previous Month Data In Column As Following Months Data Different Column

Aug 20, 2014

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,

[Code] ....

View 7 Replies View Related

Column Update . Urgent Help Required Pl. !!

Jan 11, 2002

Hi ...

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 ?

Many Thanks !!

View 2 Replies View Related

( URGENT ) *** Problem With DATE Column

May 4, 2001

Hello All,

I've a column of Date/Time type 'SenOn' in which NULL is allowed. If I enter some date in that column, and then next time again I want to make it empty (NULL I mean) there is an error that this value cant be changed.

Please note that there are no dependencies, so that is certainly not the problem.

Please help me this is really urgent.

View 2 Replies View Related

Duplicate Values In A Column.....URGENT!!

May 9, 2000

We have a table with 1 million rows with duplicates in a column which allows nulls.Can we enforce uniqueness for only future inserts by anyway(ignoring the old ones)?
Thanks!

View 3 Replies View Related

Whether A Column Exists In My Table?(Urgent)

Feb 4, 2004

Hi

Can anybody tell me how can I find whether a column exists in my table or not???

Piyush

View 12 Replies View Related

Automatically Increase ID Column(please Urgent)

Dec 17, 2005

i am trying to increase ID column automatically. i want ID column on my database to increase when i add new entry
thanks

View 11 Replies View Related







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