Viewing 15 posts - 3,886 through 3,900 (of 7,613 total)
You don't need or want the dashes in the date:
SELECT STUFF(STUFF(STUFF(main_datetime, 13, 0, ':'), 11, 0, ':'), 9, 0, ' ') + '.0000000' AS datetime2_format,
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 27, 2017 at 3:55 pm
USE database_name;
ALTER DATABASE database_name SET SINGLE_USER;
DBCC CHECKDB ( database_name, REPAIR_REBUILD );
ALTER DATABASE database_name SET MULTI_USER;
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 27, 2017 at 11:37 am
Check for a way to override the data type to be bigint (or even int, if you know that will hold all the values) instead of float(53).
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 27, 2017 at 10:43 am
I'd certainly try to fix it without allowing SQL to lose any data. If it can fix it cleanly, why leave it bad?
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 27, 2017 at 10:40 am
Something like this should do it:
.
SELECT t1.CreateDate, t2.CreateDate, DATEDIFF(MONTH, t1.CreateDate, t2.CreateDate), t1.AtNumber, t1.HFK
FROM Table_1 t1
LEFT OUTER JOIN (
SELECT *, ROW_NUMBER() OVER(PARTITION...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 21, 2017 at 3:07 pm
Or, if you want to allow @VisitID to be specified but not to require it:
ALTER procedure [dbo].[spRadialAnalyticsDataExtract_ADLAssessment]
(
@AccountNumber varchar(30),
@VisitID varchar(30) = NULL
)
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 21, 2017 at 12:07 pm
If you just want a count of the common attributes, you could do this:
SELECT RT1.ReportName AS ReportA, RT2.ReportName AS ReportB, COUNT(*) AS CommonAttributesCount
FROM ReportTable RT1
INNER JOIN...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 21, 2017 at 11:16 am
SELECT RT1.ReportName AS ReportA, RT2.ReportName AS ReportB, RT1.AttributeName AS AttributeInCommon
FROM ReportTable RT1
INNER JOIN ReportTable RT2 ON RT2.ReportName > RT1.ReportName AND RT2.AttributeName = RT1.AttributeName
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 21, 2017 at 7:48 am
If you'll post some directly useable data -- CREATE TABLE and INSERT statements -- I'll provide you code to do this (or someone else will first).
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 20, 2017 at 12:08 pm
You'll need an abstract that represents any legal entity about which you need to store information. In this case, so far that's company or shareholder.
Legal_Entities ( Legal_Entity_Id, Name,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 17, 2017 at 10:07 am
Very sorry, sp_marksystemobject is my own version of the true MS proc.
You should run this:
USE master
EXEC sys.sp_MS_marksystemobject 'dbo.sp_your_proc_name_here'
The point of creating it in master...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 17, 2017 at 8:12 am
I recommend you create a procedure in the master db that can automatically run in the context of any db you need. Below is the code to create the proc....
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 16, 2017 at 12:17 pm
ROW_NUMBER() is not gonna work prior to SQL 2005 either anyway :-).
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 16, 2017 at 12:04 pm
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 16, 2017 at 11:40 am
With thousands of users trying to modify the exact same row, SQL must do them one at a time, pausing the others until those before it complete. Otherwise, of course,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 16, 2017 at 9:54 am
Viewing 15 posts - 3,886 through 3,900 (of 7,613 total)