Delete Partial From Column

Jan 30, 2006

Guys, i have a table that one of the columns (Email To) is
a concatenated list of email addresses separated by semi colons ";".

i.e.:

rrb7@yahoo.com;richard.butcher@sthou.com;administr ator@sthou.com

etc like that.
each row varies with one exception. administrator@sthou.com is in each one.

is there a simple way thru sql or T-SQL to delete that "administrator@sthou.com" part? or should i call each row individually into say, a VB.net form using a split with the deliminator ";"
and then looping thru and updating each row?

thanks again for any easy answer
rik

View 7 Replies


ADVERTISEMENT

How To Join In As A Partial Column

Oct 2, 2013

We have here 3 tables which are linked by Order number. there is one more table we need to use to get the Shipping zone code. This column however is 10 pos. ( the order number on that table)whilst the others are all 8. We want to join on MHORDR in the table MFH1MHL0, then we are done.

SELECT
ALL T01.OHORDD, T03.IHINV#, T01.OHORDT, T01.OHJOB3, T01.OHORD#,
T02.IDPRLC, T02.IDNTU$*(IDSHP#) AS EXTSHP, T02.IDPRT#
FROM ASTDTA.OEORHDOH T01 LEFT OUTER JOIN
ASTDTA.OEIND1 T02
ON T01.OHORD# = T02.IDORD# LEFT OUTER JOIN
ASTDTA.OEINHDIH T03
ON T01.OHORD# = T03.IHORD#
WHERE T01.OHOSTC = 'CL'
AND T01.OHORDD >= 20120101
ORDER BY T01.OHORD# ASC

View 5 Replies View Related

Removing Partial String From Column

Oct 11, 2005

how do i update a table which has like two strings in 1 column like

blog, joe ?

i want to strip the joe into a new field and the blog into another field

update Agency
set firstname= substring(firstname,charindex(' ',firstname)+1 ,len(firstname))

i managed to strip the first name which is the string at the back but not the last name which is the string at the front

View 5 Replies View Related

How To Select Partial Part Of Column

Feb 20, 2014

I have a PURCHASE ORDER NUMBER which is character 24 pos. and I only want to select in the query those which start with

'101' from 1 to 3 = '101'

How to do this in the query?

View 5 Replies View Related

How To Delete Data When Column Have Depency With Other Column?

Dec 2, 2007

in Table A Column is 
PriKey             No       Name
1                      1        Apple
2                      2       Orange
3                      3        Juicy
in Table B column is
Prikey             ColumnA           Price
1                         1                     10
2                          3                     2
3                          2                     5
 
TableA.Prikey have Depency with TableB.ColumnA    
 
when I am trying to Delete data from Table A , I got error message becaue the depency
how to delete data when there have depency?
 
I just know when table have trigger , we can disable trigger before delete Data, and enable trigger when data deleted
does there have a way to disable depency and then enable ?
 
thank you

View 14 Replies View Related

[*-)]how To Delete All Columns Except One Column For The Corresponding Column Name......?

Jul 15, 2007

hi friends,          i've a table with (columns) username, content,data,........... i need to delete all column names(i.e.,content,data,........) except username for the specified username. eg: consider username=mahendran. i've to delete the values in the content,data,...............for the username=mahendran. but username should exist.how to do that?pls help me...... 

View 3 Replies View Related

Delete/Remove Column

Oct 18, 2000

Hello people

Can someone tell me if, and then how I can delete/remove a column from a table in SQL6.5. (I know how to add a column)


Regards
De Waal

View 2 Replies View Related

Delete A Column Value With Respect To Other

Jul 5, 2007

Hi
I have to delete the value of acktitle where ackby = null
I tried using update but its not helping me i tried doing

update incidents(table name)
set acktitle = null where ackby = null

its not giving me any results thats why i thought of delecting but delete syntax removes the whole row
How should i go about it

View 2 Replies View Related

How To Delete A Column Using Script Code

Nov 2, 2006

hi all iam having a  query , c guys iam having a table in sql with some coulmns in it , i have a column named as country in the table , now wat i want to be done is , i want to delete the column country based on some conditions , i ve to write a script code as : i ve to check if the column is there already or not if its there it shld delete the column or if its not there it shld not show any error and just return empty handed thats all , i dont know wat to be done , so if anyone knows abt it pls do send as soon as possible guys , hopefully waiting for a reply Note : any dbts pls do mail me again  Venkatesan 

View 4 Replies View Related

How To Avoid User Delete Column

Mar 30, 2006

Dear all

I would like to ask one sql question , it's that possible to use statement delete my columns ?

select * from tablename where columna = '--delete from tablename '

View 6 Replies View Related

Delete Output Into &<xml Column Of Audit Table&>

Mar 31, 2008

Currently running Sql Server 2005Is it possible to issue the delete command and capture the affected rows asxml types that will be stored in an audit table with an xml column?Something along the lines of:delete from source_tableoutput(deleted.*into audit_table (xml_audit_column)for xml auto)where source_table.column = @delete_value

View 1 Replies View Related

How To Reorder/compact A Column's Values After A Delete?

Feb 27, 2008



The business operation is this:
The data is stored and accessed by Invoice Number and Line Number. If there are 4 lines, 1,2,3,4 and number 2 is deleted the users want lines 3 and 4 reordered to be 2 and 3.
The existing code does things the following way, but I have my suspicions about how bulletproof it is:
Existing Data:
123,1
123,2
123,3
123,4

Begin Transaction
Delete where InvoiceNumber = 123 and LineNumber = 2.
Update set LineNumber=2 where InvoiceNumber=123 and LineNumber=3
Update set LineNumber=3 where InvoiceNumber=123 and LineNumber=4
Commit Transaction


Is there a better way of doing this?
Thanks.

View 1 Replies View Related

Transact SQL :: Delete A Default Constraint On A Column?

May 5, 2015

 I have a table named [New Item] and created a default constraint on a column, and i wanted to change the data type of the column using the query

alter table [new item]
alter column pcs_qty decimal(15,2) not null

but the name of the default constraint is 'DF__New Item__Pcs_Qt__2D12A970' and i am not able to delete the constraint because it contains a space in between.Is there any work around for this.

I tried to delete the constraint by using the query

alter table [new item]
drop constraint 'DF__New Item__Pcs_Qt__2D12A970'

but I am getting the exception,

Msg 102, Level 15, State 1, Line 2

Incorrect syntax near 'DF__New Item__Pcs_Qt__2D12A970'.

View 2 Replies View Related

Preserve ROWGUID Column During Publication Delete

Apr 30, 2007

Hello,



I am looking to preserve the ROWGUID column that is created automatically when a table is added to a publication as I have noticed that the column is removed and readded (with new values) each time the publication is deleted and recreated. We are planning on using the values in the rowguid column for a non-replication purpose, and don't wish the column to be removed or the values to be reset in the event the 'owning' publication is dropped for whatever reason. I've done some research and have identified the preserve_rowguidcol column of the sysmergearticles table as a candidate for achieving the desired goal. Before moving forward, I wanted to ask for input regarding this. Are there any best practices I've overlooked on this topic? Neither Google nor this forum's search results yield any real discussion on this topic.



Thanks!



DanD

View 7 Replies View Related

Delete/Move Certain Info From Column - Leave The Rest?

Nov 10, 2005

I have a column that contains extra info that needs to be moved to another column or deleted alltogether. is there a way to select these items and move them to another column, leaving the rest of the data in the original column?

EXAMPLE

MYTABLE >COLUMN1
May have Data Like: ABCDE123 SER1 or XYZ12DEFSer1:1

WHAT I NEED TO DO IS
Move anything after the SER1 to a new column and retain the rest of the data in the original column. making it look something like this:

COL1 COL2
ABCDE123 SER1
XYZ12DEF Ser1:1

Another question is if there is a way to delete extra spaces? Like make all data that has two or more extra spaces, just single spaces and any additional spacing after a row of data, delete all additional spaces after the last letter/character/number.

One more question - What would be a great resource to learn MS SQL in more depth?

I am trying to learn ASP/VBScript/JavaScript/ and now MS SQL all at once b/c this is what my business depends on. Trying to be 5,000 hats at once can get confusing and overwhelming, so I am looking for any "Crash course" I can to learn as much, as fast as possible. Any direction or ideas?

Thank you.

View 4 Replies View Related

Page 2 - Trying To Reorder A SortOrder Column With Delete Triggers

Dec 16, 2005

Quote: Originally Posted by mrtwice99 Yes, but how would you figure out which row was "before" it?
Code:

SELECT id, sortOrder, name FROM daTable
WHERE id = 937 OR sortorder =
( select max(sortorder) from daTable
where sortorder < ( select sortorder from daTable where id = 937) )

View 5 Replies View Related

Delete Records Based On Derived Column Content

Nov 18, 2011

I have a MS SQL table with a derived column, for date the records were imported, and need to delete records, based on the content of this column. What I need to do is delete all records from the table with a date of '2011-11-18'. Now this column is a datetime column, so it contains the time info after the date, i.e. 2011-11-18 09:29:38.000, but no matter what command I try for this:

-Delete from table where Date_Imported like '2011-11-18%'
-Delete from table where Date_Imported like '2011-11-18'
-Delete from table where Date_Imported = 2011-11-18

It comes back saying "0 rows affected", even though I know there are records with that date in the table.

View 2 Replies View Related

T-SQL (SS2K8) :: Dynamically Delete Data Based On Date Column

May 19, 2015

DELETE FROM Report_temp2
WHERE MSSalesID in
( Select Report_temp.MSSalesID FROM Report_temp)

DELETE FROM Report_temp
WHEREMSDate < '2015-07-01'

Actually the year stating form july.

Q1 is july,aug,sep.
Q2 is oct nov,dec.
Q3 is jan,feb,mar.
Q4 is april, may,june.

So what I need is dynamically I want to delete the data every year prior to current year.

View 4 Replies View Related

SQL Search :: DELETE Rows From All Tables In Database Where Column Name Is Geo And Value Is NULL

Nov 16, 2015

I need to look at all tables in a database that has a column name of GEO

Then look for all values in each table where the GEO value is NULL and delete each of the records found...

View 6 Replies View Related

How To Trap DELETE Statement Conflicted With COLUMN REFERENCE Constraint Error

Oct 26, 2004

Hi,

On my aspx Web page, I want to delete a member from database table 'tblMember', but if this MemberID is used as FK in another table, I want to display a user friendlier message like "You cannot delete this member, ....." I am using Try, Catch blocks in my Web Page.

Currently it display this message:
"DELETE statement conflicted with COLUMN REFERENCE constraint 'FK_..._....' The conflict occurred in database '...', table 'tblMembers', column 'MemberID'. The statement has been terminated. "

So how should I precisely trap this error? Does anybody know what Exception is it? or what error number in SQL server?


Thanks

View 2 Replies View Related

SQL Server 2008 :: Archive And Delete Old Records In Table With No Date Column

Feb 4, 2015

I have these two tables Log and CategoryLog, I need to archive records older than 13 months in these two tables to two separate tables and then delete the archived records from Log and CategoryLog tables. The problem is that only 'Log' table has a date column, the other table CategoryLog does not have any date column. But the two tables are connected by a column(LogID). How to archive the data and then delete the archive data from both tables.

View 9 Replies View Related

Getting Partial Recordset.

Apr 19, 1999

I'm an SQL novice, but I know this must be a common problem.

I'm trying to select a recordset (using ASP), but I know I only want part of the recordset, and am not sure how to limit it ahead of time.

For example, the query will return about 500 rows, but I know I only want to use a small section of these records.
I want to give the user the ability to navigate through small sections of these 500 rows without having to get all rows all the time.
I know ahead of time which rows to get, but have no idea how to limit the recordset before I get it (there is no fields in the database to help).

This is what I'm doing now. "select * from xyz where id=xxx order by date desc;" I know I only want the first 10, or 10-20, or 400-410.
The way I'm doing it now, I'm getting the whole recordset each time, doing a "rs.move x" where x is where I want to start.
This is really a waste of network traffic and memory since my SQL server is on a different machine as the web server running ASP.

How do I do this?

Please email me if you could at pmt@vantagenet.com

View 1 Replies View Related

Partial Search

Sep 26, 2004

Hello - I was wondering if anyone knew how to do this -

I have a database with a field for Id, LName, GName, DOB. In the LName field, some of the names have * placed after the names. Is there a way I can search for the entries in LName with the * in the record?

Thank you!

Liz

View 3 Replies View Related

Partial Trust

Sep 30, 2007

Hi Guys,

I have started a project using Linq for sql and SSCE. Everything goes well until I realize that SSCE can only run in full trust. Linq for sql is planned to support partial trust scenario. Any plans for such a support in Sql Compact Edition?

Dany

View 1 Replies View Related

How Can I Get My Code To Look For Partial Payments

Apr 12, 2008

The following code accepts a couple of parameters and creates a temp table to hold unpaid schedule rows (like invoices). Then is takes the payment amount passed and starts paying the oldest ones first, until it runs out of money or pays a partial. When it pays it inserts a row in the applieds table with the schedule_ID, Receipt_ID (payment id), applied amount, and applied date.
What I need help with is: Say there is a partial payment from a previous payment, I need to pay that one, but only the unpaid part. Then continue to pay other schedule rows...
I appreciate any help,
@PaymentAmount money,@PledgeID Int,@Receipt_ID IntAS-- Get unpaid reminder rows for the passed in pledge id and put them into the temp tableDeclare @temp_oldest Table(PledgeSchedule_ID int,ReminderDueDate datetime,AmountDue money)INSERT INTO @temp_oldest SELECT PledgeSchedule_ID, PledgeDueDate, AmountDueFROM tblPledgeReminderScheduleWHERE (dbo.tblPledgeReminderSchedule.Pledge_ID=@PledgeID) AND (dbo.tblPledgeReminderSchedule.ReceivedDate IS NULL) -- AND (dbo.tblPledgeReminderSchedule.PledgeDueDate < GETDATE())WHILE((SELECT Count(*) FROM @temp_oldest)>0)BEGIN-- If the payment is greater or equal to the amount due for the current row, do thisIF(@PaymentAmount >= (SELECT Top 1 AmountDue FROM @temp_oldest))BEGIN-- Update the reminder row with todays dateUPDATE tblPledgeReminderSchedule SET ReceivedDate = GETDATE()WHERE PledgeSchedule_ID = (SELECT Top 1 PledgeSchedule_ID FROM @temp_oldest)-- Insert a row to track applied payment and reminder row associatedINSERT INTO tblPledgeReminderSchedule_Applieds (PledgeSchedule_ID,Receipt_ID,Applied_Amount,Applied_Date)(SELECT Top 1 PledgeSchedule_ID,@Receipt_ID,AmountDue,GETDATE() FROM @temp_oldestWHERE PledgeSchedule_ID = (SELECT Top 1 PledgeSchedule_ID FROM @temp_oldest))-- Subtract the amountdue from the paymentamount and reset itSET @PaymentAmount = (@PaymentAmount - (SELECT Top 1 AmountDue FROM @temp_oldest))ENDELSEIF(@PaymentAmount < (SELECT Top 1 AmountDue FROM @temp_oldest))BEGIN -- Insert a row to track applied PARTIAL payment and reminder row associatedINSERT INTO tblPledgeReminderSchedule_Applieds (PledgeSchedule_ID,Receipt_ID,Applied_Amount,Applied_Date)(SELECT Top 1 PledgeSchedule_ID,@Receipt_ID,@PaymentAmount,GETDATE() FROM @temp_oldestWHERE PledgeSchedule_ID = (SELECT Top 1 PledgeSchedule_ID FROM @temp_oldest))BREAKENDELSEIF @PaymentAmount = 0-- Delete all rows from temp tableDELETE FROM @temp_oldestELSE-- Delete only the current row from the temo tableprint @PaymentAmountDELETE FROM @temp_oldest WHERE PledgeSchedule_ID = (SELECT Top 1 PledgeSchedule_ID FROM @temp_oldest)END 

View 1 Replies View Related

Partial Field Search

May 6, 2005

I was just wondering if anyone could tell me how to do a search for a partial data match. Say one data field is 123, 234, 345, 456 and another is 111, 222, 333, 444 and another is 555, 666, 777, 888 and I want to search for the unique number 234 but not the whole number 123, 234, 345, 456 ... is there any way to do that or does every search have to be exactly like the data in the field?
Thanks for any help.
Dennis

View 4 Replies View Related

Partial Replication Problem

Jun 15, 2000

In our database we have the concept of 'Companies' each company has an entry in a tblCompanyControls using a field lCompanyNumber to uniquely identify it.

Company specific data is then grouped within additional tables using this
lCompanyNumber.
Thus all the departments for a particular company (eg 4) exist in a table
tblDepartments with lCompanyNumber =4. The same applies for pensions, pay
elements, employees and so on.

Each employee has various attributes stored in several tables, thus the
main data is stored in tblEmployees with an lCompanyNumber to illustrate
the company they belong to. And a system generated lUniqueID that is the 1
to many relationship to tables such as tblEmployeePayElements,
tblEmployeePensionSchemes.

These in turn have a primary key that establishes a 1 to many with the
period data for pay elements etc.

What we want to do is replicate only the data for a specific company, for
tblEmployees, tblDepartments this looks straightforward as i just set a
filter like 'tblEmployees.lCompanyNumber = 4'. My problem is how do I
replicate just the tblEmployeePayElements for those employees that are in
the specific company as the table does not contain the lCompanyNumber. Can
you replicate a view? I an quite ignorant of replication and would really
appreciate some pointers. Note DRI is not in use.

View 1 Replies View Related

Partial Updates By Cursor

Sep 18, 1998

I am are running SQLSERVER SP4 on WINNT SP3.

I am serious problem of partial update my query is
something like
bEGIN tRAN
declare cursor...

SElect * from tableA where flag = null

open cursor
fetch first...

while @@FETCH_STATUS = 0
BEGIN
UPDATE TABLE tableB ..
.
.
.

fetch next
END
CLOSE ...
DEALLOCATE..
COMMIT TRAN

The problem is the cursor select retrieves
says about 10000 rows, goes thru the
loop for 1000 rows and just terminates without
giving an error message,or rolling back
in case of errors, but comes out as successfully
completed.


I am at loss as what could be the problems..
any suggestions welcome..

Thanks in advance,
Balajee.

View 2 Replies View Related

Pull In Partial String

Dec 13, 2007

Could someone please help me? I am trying to pull in a partial string (the last six characters of the field, to be exact).

This is an example of my code:

select *
into #temp_2
from #temp_1 a, Server2.DBa.dbo.table2 r
where r.field1r = a.field1a and
r.field3r = a.field3a (field3a is where I need just the last 6 characters)

To be more specific:
r.field3r looks like 000884
a.field3a looks like 17445000884
So- I just want to pull in the 000884 off of a.field3a

View 2 Replies View Related

Desperate For Even Partial Recovery

Feb 12, 2008

I have been asked to see what I can recover from a development server whose database became suspect during a power failure.

One developer from another group who's time is limited tried to repair the database using checkdb, but it is still suspect.

There are no recent backups of anything whatsoever. Needless to say, we are lacking in DBA skills here. At this point, we don't care whether we get the data back, but we are desperate to recover the table definitions, user-defined functions and stored procedures -- if not all of them than most of them; if not most of them than some.

What are our options here?

Are their any good third-party tools to help us with this problem?

View 20 Replies View Related

Joining On Partial Matches

Jul 20, 2005

Hi all,I have 2 files containing Id numbers and surnames (these filesessentially contain the same data) I want to select distinct() andjoin on id number to return a recordset containing every individuallisted in both the files HOWEVER, in some cases an incomplete IDnumber has been collected into one of the 2 files -is there a way tojoin on partial matches not just identical records in the same way asyou can select where LIKE '%blah, blah%'??Is hash joining an option i should investigate?TIAMark

View 4 Replies View Related

Partial Searches Over A Lot Of Fields

Jul 20, 2005

Hi All,I have the following scenario. I have a table called Invoice. Thishas around 30 columns of which i have to do a retrieval based onfilter conditions on 10 columns. These filters need to be partialsearches i.e. for e.g the Customer name could be 'Arun', 'Parthiv','Aaron', now i should be able to search the customer as 'ar' and itshould return 'Arun' and 'Parthiv'. My concern is there are 10 columnson which this like '%x%' search has to be done and there willpractically be hudreds of thousands of rows. can anybody suggest me toimprove the performance of such a query. Currently what i am thinkinof isselect Id, Memo, .. FROM Invoice where CustomerName like '%' + @Name +'%' and etc.P.S. am using ASP.Net as the front end.

View 1 Replies View Related

Grouping By Partial String

Jun 12, 2007

Hello All,



I am looking for an expression for a group in a matric. I am trying to figure out how to group by the a certain amount of letters in a string. For example if I have the followong fields I am grouping...



Bob001

Bob

Robert005

Doug053

Doug100

Douglas

Barney001

Frank



I want to group it up as...



Bob

Doug

Barney

Frank



And then be able to summarize the results in the matrix.



Thanks in advance for any help

-Clint

View 13 Replies View Related







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