Viewing 15 posts - 5,041 through 5,055 (of 7,597 total)
Is there some reason you want to use multiple queries? One query can do this just fine. I've properly clustered the table to match lookup requirements.
DECLARE @MyTable AS...
June 5, 2015 at 9:45 am
It's my understanding that modern VINs are indeed unique. The year byte in the VIN code is reused every thirty years, but the 17-digit combination will still be unique.
Btw,...
June 4, 2015 at 2:20 pm
I'd say varchar ... and now you have a lot of people to slap :-D.
Why on earth do people want characters in a po number??
June 4, 2015 at 1:20 pm
A vehicle should always have a VIN, and if you look up by VIN, I would go with VIN. Define it as char(17) rather than varchar, though, to save...
June 4, 2015 at 1:03 pm
If you just need whichever comes first, I suggest:
with addresses
as (select address = 'Elland **REQUIRES BOOKING IN***'
...
June 3, 2015 at 3:19 pm
You certainly could do that with a trigger. And you'd have the extra benefit of being able to cluster the resulting table exactly as you needed for querying it.
June 3, 2015 at 2:43 pm
For now you could create a non-persisted computed column you could reference in queries to get the "clean" number. Later you could make it an actual column by doing...
June 2, 2015 at 2:06 pm
Alvin Ramard (6/2/2015)
ScottPletcher (6/2/2015)
June 2, 2015 at 1:51 pm
Is it just the id and address, or is there a customer id or other parent entity for the address? If so, the clustering key should be on (...
June 2, 2015 at 1:45 pm
A scalar function will handle that just fine. Particularly if you do it only once, when the data is inserted. You can add a format code / pattern...
June 2, 2015 at 1:42 pm
Dougieson (6/2/2015)
I was thinking of using MIN...
June 2, 2015 at 11:59 am
To evaluate this, we will need considerably more info about the table and its indexes. Please copy the code below into a "New Query..." window in SSMS, change the...
June 2, 2015 at 10:32 am
Maybe something along the lines below. You could save the results into another table to come back and update the main table with the consolidated data.
You could also add:
COUNT(DISTINCT...
June 2, 2015 at 10:16 am
Very surprising that SQL doesn't the index on which it can do almost a full seek.
Do you really need the "PersonID<>0", or could you remove that? I believe that...
May 27, 2015 at 1:22 pm
Another option to generate code to be run on the other server:
DECLARE @view_template varchar(8000)
SET @view_template = '
CREATE VIEW [$schema$].[$table$]
AS
SELECT * FROM [SourceDatabase].[$schema$].[$table$] UNION ALL
SELECT * FROM [ArchiveDatabase].[$schema$].[$table$]
GO
'
SELECT REPLACE(REPLACE(@view_template,
...
May 27, 2015 at 1:09 pm
Viewing 15 posts - 5,041 through 5,055 (of 7,597 total)