Viewing 15 posts - 1,261 through 1,275 (of 1,491 total)
You will need to return an OUTPUT parameter.
The SP should look something like:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE dbo.spCDI_Add_New_CDI_Data
@sTelenumber varchar(100)
,@sDate smalldatetime
,@sTime varchar(20)
,@sRings varchar(20)
,@scallrecieved datetime
,@sName varchar(2000) OUTPUT
AS
SET NOCOUNT ON
SELECT...
March 2, 2007 at 9:04 am
Viking,
Does:
SELECT BPE.BusnPartEmpId
FROM dbo.tblBusnPartEmp AS BPE WITH (NOLOCK)
INNER LOOP JOIN dbo.tblDivBranchBusnPartEmp AS DBBPE WITH (NOLOCK)
ON BPE.BusnPartEmpId =DBBPE.BusnPartEmpId
INNER JOIN dbo.tblDivBranch AS TDB WITH (NOLOCK)
ON TDB.DivBranchId = DBBPE.DivBranchId
WHERE...
March 2, 2007 at 3:59 am
COALESCE seems to have some effect. No one had time to work out what in the following thread:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=323566#bm325392
A quick look at the query plan suggests that the COALESCE is...
March 2, 2007 at 3:41 am
Do the UNION ALL in a derived table. Something like:
SELECT CarrierName
,COUNT(*) AS Total
FROM (
SELECT CarrierName
FROM PreviousCarrierForWC
UNION ALL
SELECT txtPriorCarrier
FROM PreviousCarrierForBA
) D
GROUP BY CarrierName
March 1, 2007 at 10:15 am
If the Players table does not change much, you may want to hard code like:
SELECT MAX(CASE PlayersID WHEN 1 THEN [Description] END) AS Team
,MAX(CASE PlayersID WHEN 2 THEN [Description] END)...
March 1, 2007 at 10:03 am
SELECT ER.*
FROM employee_rates ER
LEFT JOIN employee E
ON ER.employeeID = E.employeeID
AND ER.emprate = E.emprate
WHERE E.employeeID IS NULL
or
SELECT *
FROM employee_rates ER
WHERE NOT EXISTS (
SELECT *
FROM employee E
WHERE E.employeeID = ER.employeeID
AND E.emprate =...
March 1, 2007 at 5:37 am
If you have less than about 10000 rows a triangular join, like the following, should be reasonably efficient.
If you have more than 10000 rows you will have to look at...
March 1, 2007 at 3:56 am
An index on [Date], Incident should help with the speed.
March 1, 2007 at 3:10 am
Two more thoughts for the view:
1. If you have indexes on the Foreign Keys, you could try explicitly using INNER MERGE JOIN instead of INNER JOIN.
2. I tend to avoid...
February 28, 2007 at 11:24 am
This assumes comments will never exceed 8000 characters.
-- *** Test Data ***
CREATE TABLE dbo.YourTable
(
[Date] datetime NOT NULL
,Incident int NOT NULL
,Comments varchar(100) NOT NULL
)
GO
INSERT INTO dbo.YourTable
SELECT '20070228', 1, 'c1' UNION ALL
SELECT...
February 28, 2007 at 11:17 am
This may help:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=9&messageid=347037#bm347099
February 28, 2007 at 10:13 am
As your primary key has some meaning you can get away with something like:
-- *** Test Data ***
DECLARE @t TABLE
(
Code varchar(5) NOT NULL PRIMARY KEY
,Prov varchar(25) NULL
)
INSERT INTO @t
SELECT 'BE31',...
February 28, 2007 at 6:23 am
This is all in BOL.
Smalldatetime is rounded to the nearest minute.
Milliseconds in datetime are rounded to 0, 3 or 7.
February 28, 2007 at 3:42 am
Sorry, that exhausts my suggestions.
February 27, 2007 at 8:51 am
@NetworkId should be varchar(255) to avoid datatype precedence issues.
Putting order into a view is not a good idea. Try removing the TOP 100 PERCENT and ORDER BY from the view....
February 27, 2007 at 8:35 am
Viewing 15 posts - 1,261 through 1,275 (of 1,491 total)