Viewing 15 posts - 76 through 90 (of 413 total)
This might be slightly simpler:
UPDATE tablename SET field = stuff(field, 4, 0, '.') where LEN(field) > 3
February 10, 2006 at 5:36 am
When you say "text field", do you mean a field of datatype varchar? Then use something like this:
select replace(replace(colname, char(9), ''), char(13) + char(10), '')
from table
If you mean a field...
February 10, 2006 at 5:18 am
Have a look at
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=255935#bm255940
February 10, 2006 at 5:04 am
Or
select some_value, left(some_value, 3) + '.' + substring(some_value + '00', 4, 2) from @table
February 10, 2006 at 3:37 am
Using Mathew's table definition (and only because I like to be different ):
select some_value, substring(stuff(some_value + '00', 4, 0, '.'), 1, 6) from @table
February 10, 2006 at 3:32 am
Or try this:
declare @tablename varchar(100)
select @tablename = 'yourtable'
declare @sql varchar(8000)
select @sql = 'delete ' + @tablename + ' where '
select @sql =
February 10, 2006 at 2:47 am
What's the point in calculating
SUM(All PDC where EnteredDate in current month) + SUM(All PDC where EnteredDate not in current month)
Isn't that simply SUM(All PDC)?
February 10, 2006 at 2:22 am
Never mind, I guess you still need help Try this query:
select
Ind_id as [Individual ID],
firstname as [First Name],
lastname as [Last Name],
...
February 10, 2006 at 2:08 am
Exactly - something like
SELECT H1.PhoneNum, H1.NewCol
FROM History H1
INNER JOIN History H2 on H1.ProjectID = H2.ProjectID and H1.PhoneNum = H2.PhoneNum
WHERE H1.ProjectID IN (945, 1172)
AND H1.CallDateTime > getdate() -7 AND H1.AttResult...
February 9, 2006 at 8:16 am
Not that I know much about deadlocks. But I have two suggestions for work arounds.
1. After Connection1 has updated Table2, commit and then update Table1 in a separate transaction.
2. Let...
February 9, 2006 at 8:11 am
Alternative:
UPDATE t
set t.Name = u.name
from test_update t
inner join
(
select 1 as Id, 'aaa' as Name union all
select 2, 'bbb' union all
select 3, 'ccc'
)
u on t.Id = u.Id
February 9, 2006 at 4:58 am
Using Ray's table definition, try this:
select distinct A.*
from #Contribution A
left join #Contribution B
on A.Contributorid = B.Contributorid
and datediff(mm, '1900', B.ContributionDate) = datediff(mm, '1900', A.ContributionDate) + 1
where B.ContributorId is null
February 9, 2006 at 4:38 am
I guess the above is faster if you add an index on #AllNumbers:
ALTER TABLE #AllNumbers
ADD CONSTRAINT Index_Numbers PRIMARY KEY CLUSTERED(SequenceNumber)
February 9, 2006 at 4:13 am
Sergiy, I have changed your query a little
SELECT H1.PhoneNum
FROM History H1
INNER JOIN History H2 on H1.ProjectID = H2.ProjectID and H1.PhoneNum = H2.PhoneNum
WHERE H1.ProjectID IN...
February 9, 2006 at 1:17 am
You could redesign the answers table such that the columns are as follows:
Id int, user_id int, answer_id int, answer varchar(100)
Sample data would be as follows:
1, 1, 1, 'User 1's answer...
February 9, 2006 at 1:07 am
Viewing 15 posts - 76 through 90 (of 413 total)