Viewing 15 posts - 2,536 through 2,550 (of 3,543 total)
Try this
BEGIN
DECLARE @SplitID int
SET @SplitID = 1035
SET NOCOUNT ON
SET DATEFORMAT dmy
DECLARE @DealTree table (
DealID int
, ParentID int
, lvl varchar(50))
DECLARE @Temp table...
September 29, 2004 at 6:01 am
September 29, 2004 at 4:44 am
If there are only two workshops then
SELECT q2.Location, q2.Product, q2.Workshop,
(CASE WHEN q2.WorkShop = 'Work1'
THEN (CASE WHEN q1.Unshipped_Qty > q2.TotalQTYAvailable
THEN 0 ELSE q2.TotalQTYAvailable - q1.Unshipped_Qty END)...
September 28, 2004 at 7:11 am
cannot use LEFT with text data type
September 28, 2004 at 6:33 am
For SQL2K try
declare @rc int,@dir nvarchar(4000)
exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultData', @dir output, 'no_output'
select @dir
declare @rc int,@dir nvarchar(4000)
exec @rc = master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultLog', @dir output, 'no_output'
select @dir...
September 27, 2004 at 10:41 am
SELECT i.WgtGrp, i.ItemNo, i.Description, i.RegDate, i.Weight
FROM ITEM2 i
INNER JOIN (
SELECT WgtGrp, ItemNo, MIN('2004/09/18 11:15:00' - RegDate) AS [Diff]
FROM ITEM2
GROUP BY WgtGrp, ItemNo) x
ON x.WgtGrp...
September 27, 2004 at 9:54 am
Phil's query will give errors, I think this what he meant.
SELECT
QNumber, Bulletin, Issue, Locale, Installed, Applicable,
Installed + Applicable as Total
from ( select QNumbers0 as QNumber
, ID0 as Bulletin
,...
September 27, 2004 at 9:27 am
Seems like a presentation problem more than a sql one but you are right the union output has to have the same dataype, so your best bet it to use...
September 24, 2004 at 7:07 am
This sort of question pops up now and again. Whilst the solutions presented will work and possibly satisfy most needs it got me thinking. ...
September 23, 2004 at 7:02 am
SET NOCOUNT ON
will stop the rows affected message
September 22, 2004 at 6:15 am
The following will anser you last question
WHILE CHARINDEX(',',@Section) > 0
BEGIN
insert into [TBLCONTACT_TO_TBLSECTION] puTBLCONTACT, puTBLTOP)
values (@ContactID, LEFT(@Section,CHARINDEX(',',@Section)-1)
SET @Section = SUBSTRING(@Section,CHARINDEX(',',@Section)+1,LEN(@Section))
END
insert into [TBLCONTACT_TO_TBLSECTION] puTBLCONTACT, puTBLTOP)
values...
September 21, 2004 at 7:51 am
You could use this in the where clause
CHARINDEX(',' + CAST(@LearnID as varchar) + ',',',' + puTOP_SECTIONID) + ',') > 0
but you will sacrifice performance
September 21, 2004 at 7:45 am
Try this for a laugh
SELECT COALESCE(
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9]%',[column]),15),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9]%',[column]),14),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9]%',[column]),13),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9].[0-9][0-9][0-9]%',[column]),14),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]%',[column]),13),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9].[0-9]%',[column]),12),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9].[0-9][0-9][0-9]%',[column]),13),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9].[0-9][0-9]%',[column]),12),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9][0-9].[0-9].[0-9]%',[column]),11),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9]%',[column]),14),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9].[0-9][0-9][0-9].[0-9][0-9]%',[column]),13),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9].[0-9][0-9][0-9].[0-9]%',[column]),12),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9].[0-9][0-9].[0-9][0-9][0-9]%',[column]),13),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9].[0-9][0-9].[0-9][0-9]%',[column]),12),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9].[0-9][0-9].[0-9]%',[column]),11),
SUBSTRING([column],PATINDEX('%[0-9][0-9][0-9].[0-9][0-9].[0-9].[0-9][0-9][0-9]%',[column]),12),
...
September 21, 2004 at 7:38 am
If you want to have both sets of data in the same row then you have to join the table to itself.
Performance will depend of several factors.
Correct Indexing
Dates having no...
September 1, 2004 at 7:32 am
DECLARE @monthnumber int
SET @monthnumber = 9
SELECT DATENAME(month,DATEADD(month,@monthnumber - 1,0))
September 1, 2004 at 6:54 am
Viewing 15 posts - 2,536 through 2,550 (of 3,543 total)