Viewing 15 posts - 91 through 105 (of 239 total)
Wouldn't the following cause one less access to the table tbl_userBlog?
Also this will ignore userBlog's with no comments
select tub.userblogID , tub.blogname, count(tbc.UserBlogID) as commentcount
From tbl_BlogComments tbc
March 15, 2006 at 3:00 pm
Try something like this:
drop table #table1
go
drop table #table2
go
create table #table1 (id int identity(1,1), name varchar(10))
insert #table1 values('jeff')
insert #table1 values('mary')
insert #table1 values('edward')
create table #table2 (id int, name varchar(10))
insert #table2 values(1, 'james')
--if...
March 15, 2006 at 11:20 am
Some basic optimzation techniques to check:
Are the datatypes for each column used in a join the same? Data conversion causes indexing problems.
Are there indexes indexes on JobPosting_ID in both tables...
March 15, 2006 at 11:13 am
Try this:
select COALESCE(cnts.cnt, 0) 'Received Applicants', j.JobPosting_ID, j.Job_Title, j.Job_Location, j.Job_ZipCode
from Job_Posting_Table j
left outer join (select count(*) cnt, jp.JobPosting_ID
from Job_Posting_Table jp
cross join Appliant_Table a
where distance(jp.Job_ZipCode, a.Applied_ZipCode) < a.Applied_Distanct
...
March 14, 2006 at 3:02 pm
This is untested because the zip data does not match the job and applicant data but try something like this:
drop table Zip
go
create table Zip(Zip_Code int, Longitude decimal(10,6), Latitude decimal(10,6))
go
insert Zip...
March 14, 2006 at 2:17 pm
According to BOL, the TEXT datatype can store up to 231-1 (2,147,483,647) bytes of data.
What error are you getting?
March 14, 2006 at 9:44 am
You can also try:
declare @Table1 table (someval int, fname varchar(20))
declare @Table2 table (someval int, fname varchar(20))
insert @Table1 values(1, 'Jeff')
insert @Table1 values(2, 'James-1')
insert @Table2 values(2, 'James-2')
insert @Table2 values(3, 'Ed')
select coalesce(t1.fname, t2.fname)...
March 10, 2006 at 3:39 pm
My first bit of advice would be to stop using the TOP 100 PERCENT hack to order the view. The ordering should be done in the select from the view,...
March 10, 2006 at 1:48 pm
The reason that it is failing is that some errors cause the batch to terminate, instead of the statement. In this case, each EXEC is considered a batch. Here is...
March 8, 2006 at 2:29 pm
Another example of how to trap the error:
drop table customer
go
create table customer(adddate datetime NOT NULL)
go
drop procedure sp_addNewCustomerAndAccount
go
Create procedure sp_addNewCustomerAndAccount
as
insert Customer Values(NULL)
RETURN @@ERROR
go
DROP PROCEDURE [dbo].[spBATCH_FILE_PROCESS]
go
CREATE PROCEDURE [dbo].[spBATCH_FILE_PROCESS]
AS
declare @Err int
BEGIN...
March 8, 2006 at 11:54 am
The following example causes a rollback:
drop procedure sp_addNewCustomerAndAccount
go
Create procedure sp_addNewCustomerAndAccount
as
RAISERROR ('ERROR', 10, 1)
go
DROP PROCEDURE [dbo].[spBATCH_FILE_PROCESS]
go
CREATE PROCEDURE [dbo].[spBATCH_FILE_PROCESS]
AS
declare @Err int
BEGIN TRAN
---Run some queries, etc, and then:
EXEC sp_addNewCustomerAndAccount
select...
March 8, 2006 at 11:49 am
Yes it does. You may want to try something like:
Select
, Person
, First
, Last
, DATEDIFF(day, x.Last, x.First) AS Days_Between
, CASE WHEN DATEDIFF(day, x.Last, x.First) >= 30 THEN 'Mark this person' ELSE...
March 8, 2006 at 10:44 am
Ray has the answer for handling the transactions in the procedure.
Check out the SQL BOL topic for 'nested transactions' for a detailed explanation. The following are quotes from it:
"Committing inner...
March 8, 2006 at 10:40 am
Paramind is suggesting using a table structure like this:
create table Reading
(
ReadingID bigint Identity(1,1),
timetaken datetime,
locationid int
--add other qualifying data
)
create table ReadingData
(
ReadingID bigint,
Value float
)
--then the following is very...
March 8, 2006 at 10:31 am
Viewing 15 posts - 91 through 105 (of 239 total)