Viewing 15 posts - 16 through 30 (of 902 total)
You cant use a Create <object> inside a try catch scenario as the CREATE needs to be the first statement.
That's why you use the If Exists.
If you want...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
January 29, 2016 at 7:55 am
To My knowledge TEXT data fields havent been fully depreciated and there are ways round it with Custom Datatypes when it does happen, but thought Id make you aware. ...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
December 1, 2015 at 9:20 am
To my knowledge there is no way to do this as there are simply connections that are open but not in use.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
December 1, 2015 at 12:54 am
Hi,
hope you dont mind me asking is this for an insurance company or a building maintenance company?
Just had a look at tblcall and that needs a bit of work,...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
December 1, 2015 at 12:52 am
Sergiy,
There is always the 'It depends' caveat when looking at the this type of thing, and in a lot of cases the actual table design is the issue, especially if...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 25, 2015 at 5:13 am
I suspect that the engine is reverting to a cached plan, and reading BoL in regards to the RECOMPILE query hint
Instructs the SQL Server Database Engine to discard the...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 24, 2015 at 12:43 am
what have you tried?
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 20, 2015 at 2:41 am
Thanks drew, I've just tried with First_value and an ORDER BY AsOFDate DESC) and that works perfectly.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 19, 2015 at 9:27 am
could be a couple of things, but firstly YEAR(hr.dob) will return an integer so you need to convert it to a VARCHAR so try
CONVERT(VARCHAR(10),year(hr.dob))
That should help fix it.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 19, 2015 at 9:03 am
Minnu (11/19/2015)
CREATE VIEW [dbo].[test_view]
AS
SELECT DISTINCT p_id, p_name
FROM unify
ERROR : Incorrect syntax near the keyword 'INSERT'.
Please help
You cant use an the INSERT in a view.
You could do
CREATE VIEW [dbo].[test_view]...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 19, 2015 at 7:53 am
serg-52 (11/19/2015)
Jason-299789 (11/19/2015)
The LAST_VALUE function will probably work, but will need an sort on the columns
SELECT
tgt.*
,LAST_VALUE(Class4) OVER (PARTITION BY identifier ORDER BY identifier)
FROM #TestTable tgt
Order by...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 19, 2015 at 7:31 am
Jeff,
Thank you for the feedback on the TOP 100 Percent, I do try and avoid it whenever possible, but I know ORDER BY is not allowed in CTE's without a...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 19, 2015 at 7:02 am
Jeff,
I dont think Lead/Lag will help in this case as it will only update by a given offset, so using the example
SELECT
#TestTable.*
,LEAD(class4,1,class4) OVER (PARTITION BY identifier ORDER BY...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 19, 2015 at 1:39 am
Sorry to say your script wont run for the following reasons
1) the insert into #mytable doesnt match the definition of the temp table
2) the select statement has 3 columns...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 16, 2015 at 6:48 am
Heres a good real life example I came across.
This takes annual Yield curves and then calculates a Cumulative End of Month position.
The data values provided are at End...
_________________________________________________________________________
SSC Guide to Posting and Best Practices
November 16, 2015 at 2:53 am
Viewing 15 posts - 16 through 30 (of 902 total)