Viewing 15 posts - 3,646 through 3,660 (of 5,109 total)
Instead of an IF statement, why not a CASE expression?
SELECT oi.item_name
CASE oi.item_name WHEN 'Pen' THEN 'Accessories'
WHEN 'Pencil' THEN 'Accessories'
WHEN 'Cable'...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 22, 2017 at 8:28 am
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 22, 2017 at 7:46 am
Could you perhaps format your code so that it's readable please? Having a CASE expression with each part on a separate line with 3 blank lines inbetween makes in completely...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 22, 2017 at 7:09 am
This isn't editing your code, but I've had a similar problem with an SSIS task that needs to be called from the our website. When the task is kicked off,...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 22, 2017 at 6:23 am
SQL Server 2017 is in CTP at the moment, I'm not sure it was be advisable to upgrade your current version to a test product. You would be better setting...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 21, 2017 at 7:14 am
WITH E1 AS (
SELECT 1 AS N UNION...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 21, 2017 at 6:23 am
You say your have variables, but these are column names in your query. Variables start with an @ at the beginning.
You could use a CTE to do this...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 21, 2017 at 2:14 am
As Jeff suggested, a TVF would be a much better option than a Scalar funciton for performance. So you could do something like this:CREATE FUNCTION dbo.LastBuyer_tvf (@SC1...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 21, 2017 at 2:02 am
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 21, 2017 at 1:48 am
You're using your CASE expression incorrectly.
Try:ALTER FUNCTION [dbo].[LastBuyer]
(@SC1 varchar(30), @CIE varchar(1))
RETURNS VARCHAR(3)
AS
BEGIN
DECLARE @LB VARCHAR(3)
SELECT @LB = CASE...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 20, 2017 at 10:06 am
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 20, 2017 at 2:12 am
Just to point to put, that isn't exactly what you asked. That query returns a list of logins that have their default Schema set to dbo on the current database.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 19, 2017 at 10:36 am
Do you mean?SELECT SYSTEM_USER AS ServerLogin, CURRENT_USER AS DatabaseUser;
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 19, 2017 at 9:27 am
Perhaps something like:CREATE TABLE #Sample
(Org_ID varchar(20),
Amount decimal(12,2),
date date); --That is not confusing... </sarcasm> 😉
GO
INSERT INTO #Sample
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 19, 2017 at 8:15 am
Considering you only have one criteria for red, otherwise Green:=iif(Fields!ColumnA.Value <> "tempdb" AND Fields!ColumnB.Value = "y" AND IsNothing(Fields!ColumnC.Value), "Red", "Green")
You'll need to put this expression in each cell's...
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
June 19, 2017 at 6:15 am
Viewing 15 posts - 3,646 through 3,660 (of 5,109 total)