Viewing 15 posts - 736 through 750 (of 897 total)
If you want to insert the IDENTITY value of a table into another table, there are other ways you can do it. One such way would be to use the...
June 11, 2010 at 4:44 am
CirquedeSQLeil (6/10/2010)
June 11, 2010 at 2:06 am
Another Trick Question that is sure to generate quite a bit of debate. You dont learn anything new, and lose 3 points. I am sure many would be knowing the...
June 10, 2010 at 10:44 pm
See if this query returns any negative value in the result set
;WITH CTE AS
(
SELECT Field9,
RowID,
...
June 6, 2010 at 11:22 pm
Try this
Create Table Job (JobID int identity, Role char(10), Location char(50))
Create Table Employee (EmpID int identity, EmpName char(50), Role char(10), Location char(50), JobID int)
Insert into Job (Role, Location) Values ('SE',...
June 4, 2010 at 7:11 am
Please post the table structure, sample data and the desired output in a readily consumable format. I am sure you will get help immediately. Your explanation and example is quite...
June 3, 2010 at 10:58 pm
Change it like this
ALTER TABLE Transactionlog
ADD businessunit_id NUMERIC(10,0), businessunit_name VARCHAR(250)
June 2, 2010 at 10:59 pm
Add the MAXRECURSION option
SELECT thedate, val1, calc
FROM cte_final_data
OPTION ( MAXRECURSION 0 )
This will work for larger datasets( 0 stands for infinite here ). But yes,...
May 28, 2010 at 4:27 am
You can do this using CTE
; WITH cte_data AS
(
SELECTROW_NUMBER() OVER ( ORDER BY thedate ) Row, *
FROM@data
), cte_final_data AS
(
SELECTRow, thedate, val1, 0 calc
FROMcte_data
WHERERow = 1
UNION ALL
SELECTdata.Row, data.thedate, data.val1,...
May 28, 2010 at 3:55 am
Maddy...! (5/27/2010)
I gave that statement bcoz Dave gave me some blog link to verify so i asked him and told him if you can...
May 27, 2010 at 10:42 pm
Change it to
select Exam, substring(Exam,1,3),sk.level1name
from EmployeeInfo ed
left outer join Skills sk
on ed.Exam = sk.level1name
where empid = 161522
and sk.level1name like @ucf + '%'
May 27, 2010 at 6:25 am
A LEFT OUTER JOIN with the same table again will give you the desired result
SELECTEmp.Emp_Name, Sup.Emp_Name Sup_Name
FROMEmployee Emp
LEFT OUTER JOINEmployee Sup ONEmp.Supervisor_ID = Sup.Emp_ID
May 27, 2010 at 4:06 am
Remove the DAY function like this
SELECTContainer_Id, End_Journey_Date
FROMdbo.Container
WHEREDATEDIFF( DAY, '1/29/2009 12:00:00 AM', End_Journey_Date ) <= 5
May 26, 2010 at 11:55 pm
Its still not very clear. Can you provide the expected result. That would certainly help people help you. And if you provide it in a ready to use format as...
May 26, 2010 at 7:01 am
You can also use a Tally Table for the same. Once you create a Tally table you can use the script given below to get the desired results.
DECLARE@sdtStartTimeSMALLDATETIME
DECLARE@sdtEndTimeSMALLDATETIME
DECLARE@iSlotsINT
SET@sdtStartTime = '26-May-2010'
SET@sdtEndTime...
May 26, 2010 at 3:04 am
Viewing 15 posts - 736 through 750 (of 897 total)