Viewing 15 posts - 1,066 through 1,080 (of 3,543 total)
btw this will only allow 99 occurrances
May 26, 2011 at 9:08 am
Use a trigger like this
CREATE TRIGGER trg_test ON [Test] FOR INSERT AS
UPDATE t
SET t.eng_ref=t.eng_ref+RIGHT('0'+CAST(t.test_id as varchar),2)
FROM [Test] t
JOIN inserted i ON i.test_id=t.test_id
May 26, 2011 at 9:07 am
Gopal Singh (5/26/2011)
I have create table Test table with primary key id test_Id and auto increment when inserting a record in a table, then i add another field with...
May 26, 2011 at 8:44 am
LEFT(RefNo,PATINDEX('%[0-9]%',RefNo)-1)+
CAST(CAST(SUBSTRING(RefNo,PATINDEX('%[0-9]%',RefNo),255) as int)+1 as varchar)
May 26, 2011 at 6:51 am
SELECT a.NUMBER, a.[TYPE], a.DATESTAMP, b.ASSIGNMENT
FROM (SELECT ROW_NUMBER() OVER (PARTITION BY act.NUMBER ORDER BY act.THENUMBER ASC) AS [RowNum],
act.THENUMBER, act.NUMBER, act.[TYPE], act.DATESTAMP
FROM #tbl_ACTIVITY act WHERE act.[TYPE] <> 'Notification') a
JOIN...
May 25, 2011 at 7:08 am
calvo (5/19/2011)
Here's what I came up with
declare @x varchar(50) = 'Jane Smith 05 18 2011 mamm.pdf'
select...
May 19, 2011 at 8:44 am
Providing that the month is the first 2 digits and the date is 10 chars long then this should work
ISDATE(REPLACE(SUBSTRING([column],PATINDEX('%[0-9][0-9]%',@x),10),' ','/'))
and
CAST(REPLACE(SUBSTRING([column],PATINDEX('%[0-9][0-9]%',@x),10),' ','/') as datetime)
May 19, 2011 at 6:56 am
WITH cte (PeriodID,StaffInitials)
AS (
SELECT p.PeriodID,s.StaffInitials
FROM (SELECT DISTINCT t.DayId,t.PeriodID FROM tTimeTable t WHERE t.DayID = 1) p
CROSS JOIN tStaffTimeTableInfo s
WHERE NOT EXISTS(SELECT * FROM tTimeTable t...
May 17, 2011 at 10:05 am
I think this will work but there must be a better way, just cannot think of it at the moment.
WITH p (DayId,PeriodID)
AS (SELECT DISTINCT t.DayId,t.PeriodID
FROM tTimeTable t
WHERE...
May 17, 2011 at 7:31 am
p.s. I normally run the SELECT without the INSERT and analyse the output for duplicates and start backwards from there.
May 17, 2011 at 6:42 am
Ninja's_RGR'us (5/17/2011)
Checked the inner join to make sure they don't double the keys somehow??
What Ninja's stated is most likely the cause.
Most of PK violations I come across are due to...
May 17, 2011 at 6:40 am
Ray K (5/13/2011)
Brandie Tarvin (5/13/2011)
WOTD:
:w00t: :hehe: :crazy:
May 13, 2011 at 8:00 am
Or without the cte
SELECT
CAST(LEFT([Data Team],2) as int)+CAST(LEFT([CRM],2) as int)+CAST(LEFT([IM Team],2) as int)
+(CAST(RIGHT([Data Team],2) as int)+CAST(RIGHT([CRM],2) as int)+CAST(RIGHT([IM Team],2) as int))/60 AS [HH],
(CAST(RIGHT([Data Team],2) as int)+CAST(RIGHT([CRM],2) as int)+CAST(RIGHT([IM...
May 12, 2011 at 1:55 am
pee - the dog last night and none on the roofs here. A lot in the grass.
May 11, 2011 at 10:03 am
This will give you hours and minutes which you can then format into HH:MM or how you wish.
WITH cte (HH,MM)
AS (SELECT
CAST(LEFT([Data Team],2) as int)+CAST(LEFT([CRM],2) as int)+CAST(LEFT([IM Team],2) as...
May 11, 2011 at 9:49 am
Viewing 15 posts - 1,066 through 1,080 (of 3,543 total)