Viewing 15 posts - 766 through 780 (of 897 total)
If you want to do an UPDATE for all the deleted rows, the query provided by me will work fine. You don't need to put any Where Clause.
If you want...
April 21, 2010 at 4:45 am
You can use a simple join to do this
UPDATESW
SETcount = count - 1
FROMsomewhere SW
INNER JOIN deleted D ON SW.idsomewhere = D.id
April 21, 2010 at 4:23 am
gaurav-404321 (4/17/2010)
DELETE FROM sectionnumeric
FROM dbo.CreateSectionTableFromString(placementcandidatelanguageproficiency,placementcandidatetrainingsinternshipsprojects,placementcandidatequalificationdetails)
This query is giving lot of errors. I think some syntax mistake...
April 17, 2010 at 12:35 pm
You can use Dynamic SQL for the same
DECLARE@strSQLVARCHAR(500)
DECLARE@toUpdateVARCHAR(100)
DECLARE@selecteditemVARCHAR(100)
SELECT@toUpdate = 'var2_N',
@selecteditem = 'var1_N'
SELECT@strSQL = ' UPDATE dbo.tbl_data '
+ ' SET var2 = ' + @toUpdate
+ ' WHERE var1...
April 17, 2010 at 1:38 am
Is your expected output
DELETE FROM placementcandidatelanguageproficiency
DELETE FROM placementcandidatetrainingsinternshipsprojects
If it is so, then you can create the script using Dynamic SQL
DECLARE@strSQL VARCHAR(MAX)
SELECT@strSQL = COALESCE( @strSQL + CHAR(10), '' )
+ ' DELETE...
April 17, 2010 at 1:26 am
You can also use a CROSS APPLY for the same
selectT.*
fromTrip Tr
cross apply (
selecttop 1 Trip.id, TrackPoint.lat, TrackPoint.lon
from TrackPoint
join Track on Track.id = TrackPoint.trackID
...
April 16, 2010 at 11:32 pm
You can use ROW_NUMBER() for the same
; WITH cte_Track_Details AS
(
SELECTROW_NUMBER() OVER( PARTITION BY Trip.id ORDER BY Trip.id, TrackPoint.lat, TrackPoint.lon ) RowNum,
Trip.id, TrackPoint.lat, TrackPoint.lon
FROMTrackPoint
INNER JOIN Track ON Track.id =...
April 16, 2010 at 11:21 pm
You can use the ROW_NUMBER() function
; WITH cte_Table AS
(
SELECTROW_NUMBER() OVER ( PARTITION BY id, name ORDER BY date DESC ) Row_Num, *
FROMTable
)
SELECT*
FROMcte_Table
WHERERow_Num = 1
April 15, 2010 at 10:17 am
COldCoffee (4/13/2010)
April 13, 2010 at 7:46 am
Does this help..
SELECTO.OwnerID, O.Owner_Name, COUNT( P.Pet_id ) [Count]
FROMOWNER O
LEFT OUTER JOINPET P
ON O.Owner_id = P.Owner_id
AND P.Pet_Age > 4
April 13, 2010 at 5:45 am
Look for sp_send_dbmail in Books Online or Google.
April 13, 2010 at 5:06 am
You will have to do this for the 2nd and 3rd parameter. But in your case the 2nd parameter cannot be negative. But you can still check to be sure..
April 13, 2010 at 4:48 am
; WITH cte_Schedule_Audit AS
(
SELECTROW_NUMBER() OVER( PARTITION BY ID, Action ORDER BY ID, ModifiedOn DESC ) RowNum, *
FROM#Schedule_Audit
)
SELECTI.ID, I.M_ID, I.T_Name, I.T_Desc, I.Sch_Time, I.CreatedBy, I.CreatedOn, U.ModifiedBy, U.ModifiedOn,
D.DeletedOn, D.DeletedBy
FROMcte_Schedule_Audit I
LEFT JOIN cte_Schedule_Audit U...
April 13, 2010 at 4:28 am
See if this query returns any negative values
SELECT
CHARINDEX('/',LineRead,CHARINDEX('/',LineRead)+ 1)-1 - CHARINDEX('/',LineRead)
,CHARINDEX('/',LineRead,CHARINDEX('/',LineRead,CHARINDEX('/',LineRead)+ 1)+1)-1
- CHARINDEX('/',LineRead,CHARINDEX('/',LineRead)+ 1)
,CHARINDEX('/',LineRead,CHARINDEX('/',LineRead,CHARINDEX('/',LineRead,CHARINDEX('/',LineRead)+ 1)+1)+1)- 1 -
...
April 13, 2010 at 4:06 am
Yes, tried it just now. It doesn't work. I thought the alias name was the problem, hence didn't test. Even i would have done the same in such a case....
April 13, 2010 at 3:53 am
Viewing 15 posts - 766 through 780 (of 897 total)