Viewing 15 posts - 121 through 135 (of 240 total)
you are correct (n)varchar is variable length while (n)char is fixed length
March 3, 2006 at 1:43 pm
Print to where? A printer? The output window of QA?
select * from table prints all the data.
March 3, 2006 at 1:41 pm
Try something like this:
declare @CONTHIST table (Company varchar(4), Duration varchar(8))
insert @CONTHIST values ('aaa', '01:00:00')
insert @CONTHIST values ('aaa', '02:00:01')
insert @CONTHIST values ('aaa', '00:01:00')
insert @CONTHIST values ('bbb', '00:01:00')
--works if total is <...
March 3, 2006 at 1:14 pm
DBCC CHECKIDENT doesn't work with a table variable. This works fine:
SET NOCOUNT ON
Create TABLE #tbl (RowID INT IDENTITY, descr varchar(10) )
insert into #tbl
SELECT 'a'
UNION
select 'b'
UNION
select 'c'
UNION
select 'd'
UNION
select 'e'
SELECT * FROM...
March 1, 2006 at 1:53 pm
Yes, it returns the week of the year. Try this:
select datepart( wk, '28 Feb 2006')
March 1, 2006 at 9:37 am
How about this:
create function fnTime(@Hours int)
Returns varchar (8000)
as
begin
declare @t varchar(8000)
SELECT @t = CAST(@Hours/24 AS VARCHAR(2)) + ' Day(s)' + ' and ' + CAST(@Hours%24 AS VARCHAR(2)) + ' Hour(s)'
return(@t)
end
go
declare @t1...
February 28, 2006 at 2:14 pm
PW,
In trying to test both scenarios, the following doesn't work. Any idea why?
declare @tblARData table (site int)
insert @tblARData values(1)
insert @tblARData values(2)
insert @tblARData values(2)
insert @tblARData values(3)
declare @tblARDataTemp table (site int)
insert @tblARDataTemp...
February 28, 2006 at 2:04 pm
I would code the delete using:
DELETE ar
FROM tblARData As ar
INNER JOIN tblARDataTemp As t
ON t.Site = ar.Site
Is WHERE EXISTS(...) more efficient than this?
February 28, 2006 at 1:13 pm
Just 2 general comments:
Best practice dictates that table names should be singular not plural because on row is a booking, not a bookings.
use INNER JOIN syntax such as:
FROM tbl_hp_bookings_transactions BT...
February 28, 2006 at 11:44 am
Try something like this:
declare @Item table(ItemID int)
insert @Item values (1234)
insert @Item values (4567)
declare @Balance table(ItemID int, Location int, Quantity int)
insert @Balance values(1234,201,12)
insert @Balance values(1234,301,10)
insert @Balance values(1234,501,11)
insert @Balance values(4567,201,22)
insert @Balance values(4567,301,14)
insert...
February 28, 2006 at 11:38 am
Try this:
LEFT JOIN
(
SELECT
B.homeworkerid,
SUM(transactionamount) AS TransactionAmount
FROM
tbl_hp_bookings_transactions BT WITH (NOLOCK),
tbl_hp_bookings B WITH (NOLOCK)
WHERE
BT.bookingid = B.bookingid
AND
datepart(m, BT.TransactionDate) = datepart(m, @StartSerial)
GROUP BY B.homeworkerid
) dtHWDiscount
ON
(dtHWDiscount.homeworkerid = AU.userid)
or this:
declare @serialstart datetime
select @serialstart = '20 Dec...
February 28, 2006 at 11:29 am
I would create the views once outside of the DTS package and just reference them within the DTS package and sprocs.
February 28, 2006 at 10:53 am
Just a note about SQL time slices. SQL Server uses 3 millisecond increments and rounds up. The last possible time in a day is 23:59:59.997.
February 28, 2006 at 10:09 am
You may want to try using a function for something like this, depending on the usage of the statement.
create function fnGetWeekNo
(
@CheckDate Datetime
)
returns integer
as
begin
return (select datepart( wk, @CheckDate))
end
go
select dbo.fnGetWeekNo('01...
February 28, 2006 at 9:54 am
Here is a good example explaining the database normalization process
February 28, 2006 at 9:17 am
Viewing 15 posts - 121 through 135 (of 240 total)