var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: complicated SQL help
Perhaps you can help with something that I consider kind of omplicated? (I am SO hoping that I am NOT going to have to do this manually!!!)
I have a table (about 3000 rows) where two of the columns have Domain User information.
COL1 has DOMAIN\Username and COL2 has (or SHOULD have) DOMAIN@username.com
I need to look at each field in COL1 and if exists DOMAIN\username, I need to populate COL2 with username@DOMAIN.com
Is this possible???
tip: back up your data before trying this
set COL2 = substring(COL1
+ '@' +
where coalesce(COL1,'') > ''
Thank you! That's a start! I learn so much from these forums!!
Problem is... I still do not have the .com part of the email@example.com in COL2
I also found out that once I populate COL2 correctly, I need to CLEAR any field in COL2 that does not adhere to "firstname.lastname@example.org" and then change domain to correctdomain so that all of the poplated fields in COL2 will read email@example.com
well, that's easy, just concatenate '.com' onto the end!
Originally Posted by
Thanks.. what about the fields that got pulled over that don't adhere to the
username@Domain.com criteria? Is there a way to clear any fields that are not LIKE username@Domain.com ?
What do you have beside DOMAIN\username in the column?
select COl1, COL2
where COL1 not like 'DOMAIN%'
My COL2 is now correct. all fields have
What I need to do is clear or delete any fields that do not have specially
in other words. I need to keep all fields in COL2 that are LIKE @DOMAIN.com
and delete all others (some are firstname.lastname@example.org or email@example.com)
Delete from MYTABLE
Where COL2 LIKE '%@anotherdomain.com%'
but that deleted the whole row.. I need to just clear the field in COL2
SET COL2 = NULL
WHERE COL2 NOT LIKE '%@theDomainRecordsToKeep.com'
Retired Moderator at , for all of your Visual Basic needs. Xtreme VB Talk
This is the code I ended up using..
SET COL2= PARSENAME(REPLACE(COL1, '\', '.'), 1) + '@' +
PARSENAME(REPLACE(COL1, '\', '.'), 2) + '.com'
WHERE COL1 LIKE '%DOMAIN\%'
SET COL2 = Replace(COL2,'DOMAIN','CORRECTDOMAIN')
Seems to work..