Viewing 15 posts - 5,056 through 5,070 (of 7,610 total)
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
Create a replacement values table, and use it to do the data replacement.
CREATE TABLE dbo.data_replacements (
column_name varchar(30) NOT NULL,
current_value varchar(100) NULL,
...
May 22, 2015 at 8:25 am
You'd have to generate dynamic SQL to do that. First, get the highest count as it exists ni your current data. Then modify the above overall structure to...
May 21, 2015 at 4:18 pm
Viewing 15 posts - 5,056 through 5,070 (of 7,610 total)