Viewing 15 posts - 961 through 975 (of 1,491 total)
ALTER PROCEDURE usp_getEmails @skill1 nvarchar(20), @skill2 nvarchar(20), @skill3 nvarchar(20), @skill4 nvarchar(20) OUTPUT, @email nvarchar(1000)
July 21, 2009 at 10:43 am
The parameter needs to be declared as OUTPUT in the procedure definition.
@skill4 nvarchar(20) OUTPUT
July 21, 2009 at 10:09 am
If you are porting an application from Oracle, I would strongly suggest you redesign the way keys are created.
If you really want to proceed with this idea, and do not...
July 20, 2009 at 3:32 am
or
SELECT T1.placementId, T1.userId, T1.createdOn
,MAX(T2.createdOn) AS PrevDate
FROM placementconsultant T1
LEFT JOIN placementconsultant T2
ON T2.userId = T1.UserId
AND T2.createdOn < T1.createdOn
GROUP BY T1.placementId, T1.userId, T1.createdOn
or
CREATE TABLE #temp
(
placementId int NOT NULL
,userId int NOT NULL
,createdOn datetime...
July 16, 2009 at 7:41 am
Try this:
SELECT DISTINCT
emp.First_Name
,emp.Last_Name
,emp.Middle_Name
,comp.employee_id
,comp.request_dt
,comp.numofdays
,comp.reason
,comp.request_by
,comp.approve_dt
,tech.First_Name + ' ' + tech.Last_Name + ' ' + COALESCE(tech.Middle_Name, '') AS REQUESTEDBY
,comp.approve_status
,comp.approve_desc
,COALESCE(approve.first_name + ' ' + approve.last_name, '') AS APPROVEBY
FROM employee_tbl emp
JOIN l_compoff_tbl comp
ON emp.employee_id...
July 16, 2009 at 6:32 am
You can use either a Numbers/Tally table or a Calendar Table
(Plenty of examples of both on this site)
Here is an example of how to approach the problem with an inline...
July 9, 2009 at 8:41 am
UPDATE invoices
SET net =
(
SELECT SUM(T1.ipay)
FROM trans T1
WHERE invoices.invno = T1.invno
)
-- you may want this to stop nulls when no trans for an invoice
-- WHERE EXISTS
-- (
-- SELECT *
-- FROM trans...
July 9, 2009 at 4:19 am
SCOPE_IDENTITY() is fine for simple inserts but be aware of the following parallelism bug:
http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=328811
July 8, 2009 at 7:55 am
The following works for the sample data:
-- needed if not defaulting to American date format
-- SET DATEFORMAT MDY
--- *** Test Data ***
DECLARE @t TABLE
(
StringDate varchar(20) NOT NULL
)
INSERT INTO @t
SELECT '07/01/09'...
July 1, 2009 at 10:57 am
A table is an unordered set.
July 1, 2009 at 8:58 am
You could start by making B.DAT_TIM SARGable, something like:
DECLARE @STARTDATE AS datetime
SET @STARTDATE = '20090624'
SELECT SUBSTRING(A.TERM_ID, 1, 3) + 'Y' AS TERMID
,MAX(B.DAT_TIM) AS LASTTRX
FROM dbo.TBL1 AS A
JOIN dbo.TBL2 AS B
ON...
June 30, 2009 at 10:07 am
We have used agile methods for creating a prototype to obtain user feedback when faced with a vague specification. (Some basic OO analysis was also done - use cases, base...
June 26, 2009 at 4:35 am
According to relational theory a table is an unordered set.
This means that the order of rows outside the ORDER BY clause cannot be guaranteed.
If you want rows returned in the...
June 25, 2009 at 9:21 am
or:
SELECT t
FROM @t
ORDER BY CASE t WHEN 'O' THEN 1 ELSE 0 END, t
June 24, 2009 at 6:04 am
If you can upgrade to SQL2008, the following may be worth looking at as an alternative to XML.
http://www.sqlservercentral.com/articles/SQL+Server+2008/66554/
It looked like an interesting idea but I have not yet got around...
June 11, 2009 at 10:20 am
Viewing 15 posts - 961 through 975 (of 1,491 total)