Viewing 15 posts - 481 through 495 (of 684 total)
I agree, subqueries are cheap and nasty and it was the first thought that came to me. Now that I see you using min and max to get the...
July 13, 2006 at 2:14 pm
The above query might still work then - as long as you don't have more than 2 drivers. If there is only 1 driver then the Driver2 subquery will...
July 13, 2006 at 9:31 am
I wouldn't say that this is advisable (or the best way to do it necessarily) but you could do it like so:
This assumes that you will always have 2 rows...
July 13, 2006 at 9:11 am
Hi,
sorry, declare @cmd as nvarchar(4000).
Karl
July 13, 2006 at 8:13 am
Hi,
Assuming that it is PlateNumber and StartDate that determine a unique voyage then you can simply do the following.
insert into somenewtable
select distinct PlateNumber, StartDate
from Voyage
Hope that helps,
July 13, 2006 at 7:45 am
Hi,
This cannot be the entire T-SQL script because it is incomplete. Anyway, to run the dynamic sql you can use the following method.
while @@fetch_status = 0
begin
declare @cmd varchar(8000)
set @cmd...
July 13, 2006 at 7:42 am
Yep,
you're right. This is crazy . Anyway, here goes:
--assumes that all params have same number of inputs
while charindex('|',@param1) > 0
begin
...
July 13, 2006 at 7:37 am
Hi Varun,
Just copy the backup file to your local machine and run the following statement:
restore database newdatabase
from disk = '\' --path and filename of backup file
--options if any go here
You...
July 13, 2006 at 4:45 am
Hi Zia,
the update statement I provided will replace all occurrences of the string 'AF' with 'ADF' in the Items column. So it won't update fields like '12345F'.
You just have...
July 13, 2006 at 3:06 am
Hi Zia,
We'd need to know a little more about the format of the data in the Items column. Are the first 4 characters always numeric? Are the last...
July 13, 2006 at 1:33 am
Hi Brian,
such a script would depend on how the data is stored in the full_name column. Specifically, how is the first and last name seperated - with a space,...
July 12, 2006 at 7:06 am
Hi Nick,
You can use the identity property on the OrderLineId colum.
create table OrderLines
(OrderLineId int identity,
OrderId int,...etc)
Incidentally, if you're going to have OrderLineId increment by one then it is fair...
July 12, 2006 at 1:22 am
Try this:
select p1.ProductName as ParentProduct, p2.ProductName as ChildProduct
from Products p1 join Kits k on k.ParentProductId = p1.ProductId
join Products p2 on p2.ProductId = k.ChildProductId
join Cart c on c.ProductId = p1.ProductId
where c.CartId...
July 11, 2006 at 1:29 am
Hi Chris,
ideally you want to transfer the logins prior to setting up log shipping because once the primary server goes down you'll have little chance of transferring them from the...
July 7, 2006 at 2:09 pm
Hi,
You can check the variable like this.
if @BookRate is null set @BookRate = 0
Or you can incorporate the check within the update statement itself using the ISNULL function.
UPDATE BooksTbl SET...
July 6, 2006 at 4:01 am
Viewing 15 posts - 481 through 495 (of 684 total)