Viewing 15 posts - 16 through 30 (of 327 total)
How about just this:
insert into mytable (firstname, lastname)
VALUES ('John', 'Doe')
The system will set the timestamp value for you.
ron
December 12, 2005 at 12:13 pm
From BOL:
Replaces all occurrences of the second given string expression in the first string expression with a third expression.
REPLACE ( 'string_expression1' , 'string_expression2' , 'string_expression3' )
declare @MyString varchar(20)
set @MyString...
December 12, 2005 at 8:52 am
It might help to look at this from a different point of view. What if it was critical to NOT return records where the value MIGHT be zero.
The fact that...
December 12, 2005 at 8:18 am
Check out this thread on the T-Sql forum.
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=241022#bm242133
ron
December 9, 2005 at 8:50 am
Jesper be careful, your first statement does NOT return ALL available numbers.
Set NOCOUNT ON
create table testtable (id int)
go
insert testtable select 1
insert testtable select 2
insert testtable select 3
December 9, 2005 at 8:29 am
Similar to the answer above, create a numbers_table. Populate it in a loop to cover the range of numbers needed.
Do NOT delete from this numbers_table as it can be usful in...
December 8, 2005 at 6:15 pm
No, just a waste of resources. Get rid of the duplicate index.
ron
December 8, 2005 at 5:56 pm
Or if you prefer:
declare @date datetime,
@days int,
@month int,
@year int
select @month = 4, @days = 1, @year = 2005
select @date = cast(@month as varchar) + '/'...
December 8, 2005 at 3:14 pm
Building on PW's statement I think this will work:
Select A.Product_id, A.Purch_Date, B.*
From A
Inner Join B
On A.product_id = B.product_id
-- Join to derived table of most recent update per product
Inner...
December 6, 2005 at 11:26 am
Yes, EXISTS should give you better performance. The greater the number of potential items within the IN the better the performance of EXISTS over using IN.
ron
P. S. With all due...
December 6, 2005 at 10:49 am
I really think this will perform well with the proper indexes as I suggested above.
ron
December 6, 2005 at 10:35 am
I think this works:
(@intContactCategory is null or EXISTS (select CC.fk_intUserID from dbo.tblContactCategories_Users CC where CC.fk_intContactCategoryID = @intContactCategory
And cc.fk_intUserId = U.pk_UserId))
Ron
Edit: An index on cc.fk_intContactCategoryID...
December 6, 2005 at 10:21 am
This is most probably the part that is the cause of it to be slow:
or U.pk_intUserID in (select CC.fk_intUserID from dbo.tblContactCategories_Users CC where CC.fk_intContactCategoryID = @intContactCategory))
The IN...
December 6, 2005 at 10:12 am
Please post the exact statement you are running that is giving you the error.
ron
December 6, 2005 at 8:45 am
The only way to guarantee the order in which rows from a Select statment are displayed is to use an ORDER BY clause in your statement.
ron
December 6, 2005 at 8:31 am
Viewing 15 posts - 16 through 30 (of 327 total)