Viewing 15 posts - 2,776 through 2,790 (of 8,731 total)
What problem are you facing?
This works:
CREATE TYPE SomeTableType AS TABLE
( SomeID int IDENTITY(1,1)
, SomeValue Varchar(10)
, SomeDate datetime DEFAULT GETDATE());
GO
DECLARE @test-2 AS SomeTableType;
INSERT INTO @test-2 (SomeValue) VALUES ('ABC');
SELECT * FROM...
June 2, 2016 at 8:13 am
If you'll use it to learn, practice or any non-production related functionality, I would suggest that you try the developer edition. You can get it here: https://www.visualstudio.com/en-us/products/visual-studio-dev-essentials-vs.aspx
June 2, 2016 at 8:03 am
Maybe you need to aggregate?
SELECT
CALL_1,
MAX(CASE WHEN RESP.OUTCOME1 = OUT.OUTCOME THEN OUT.SIMPLIFIED END) AS OUTCOME_1,
CALL_2,
MAX(CASE...
June 2, 2016 at 7:50 am
Dynamic pivoting is not the easiest thing, but once you understand how it works, it's really simple.
The first part is to understand how to do it in a static way....
June 2, 2016 at 7:39 am
I prefer to use QUOTENAME which will escape quotes and brackets correctly, as well as handle weird names.
DECLARE
@dbname sysname,
@objname sysname,
...
June 2, 2016 at 7:02 am
ChrisM@Work (6/2/2016)
There are several ways to do this, most of them are compared here.
I would suggest that you use the XML PATH option (unless you already use CLR). If you...
June 2, 2016 at 6:40 am
Luis Cazares (6/1/2016)
June 2, 2016 at 6:30 am
Here are four out of six formulas. You need to understand those, then create the 2 missing ones. Avoid scalar functions and use inline table functions or use the scalar...
June 1, 2016 at 2:22 pm
This is a corrected script for some sample data.
It doesn't fix any logic, just fixed the sample data script and changed formulas for the dates to shorter versions.
CREATE TABLE [dbo].[PNS_Sect_6_SiteSEPStatusSnapshot](
[ID]...
June 1, 2016 at 7:52 am
Grant Fritchey (5/31/2016)
Because SQL Fertilization needs to become something we all talk about. It's important. Don't you understand how SQL Fertilization works?
I have to say a lot of people have...
May 31, 2016 at 11:45 am
DamianC (5/31/2016)
I had an open topic (1790418)
It seems to have disappeared
I'm still in the process of trying to resolve the issue and can no longer...
May 31, 2016 at 10:26 am
Is SQL Fertilization the reason we have so much code and practices that look like feces?
May 31, 2016 at 10:21 am
GSquared (5/31/2016)
Any reason to not use UNPIVOT for this?
Confusing syntax, in my opinion. But that's a personal preference.
May 31, 2016 at 10:16 am
Something like this?
DECLARE @SQL varchar(max);
SET @SQL = (SELECT Query + CHAR(10) FROM #Temp FOR XML PATH(''), TYPE).value('./text()[1]', 'varchar(max)');
EXEC( @SQL);
Or this:
DECLARE @sql varchar(max)...
May 31, 2016 at 10:15 am
Avoid using UNION when you're not trying to remove duplicates. Use UNION ALL to include all items and avoid unnecessary sorts.
I would use a table valued constructor instead.
SELECT ...
May 31, 2016 at 9:06 am
Viewing 15 posts - 2,776 through 2,790 (of 8,731 total)