Viewing 15 posts - 211 through 225 (of 7,191 total)
No cursor required. You can do it something like this:
CREATE TABLE Rules (
Product char(1)
,Code smallint
,Height smallint
,Width smallint
);
INSERT INTO Rules
VALUES
('A', 5, 10, 5)
,('B', 0, 8, 7);
SELECT
p.Product
,CASE
WHEN r.Code IS...
January 23, 2020 at 10:44 am
I imagine that's because the script generated is a SQLCMD script that includes commands to make sure each statement is run against the correct server. When you did it manually,...
January 22, 2020 at 3:13 pm
That's not the query I posted, though. Yes, you want customers who have a trial but not a monthly. In other words, the highest product they have is Trial, and...
January 22, 2020 at 2:33 pm
This is a SQL Server forum. Maybe someone here will know why that's not valid syntax in Oracle, but you'd probably be better off posting your question on an Oracle...
January 22, 2020 at 12:32 pm
Put TOP 1 after SELECT, and ORDER BY EFFDT DESC at the end of your query.
John
January 22, 2020 at 12:18 pm
No. Trial comes after Monthly alphabetically. That query can't produce any results for that reason. Surely you're looking for customers who have a Trial but don't have a Monthly? That's why...
January 22, 2020 at 11:59 am
Oh, I see what's happened. The xp_cmdshell process can't see your @cmd variable, so you need to insert it into your string before you run xp_cmdshell.
SET @cmd...
January 22, 2020 at 11:44 am
When you run xp_cmdshell, the command is shelled out to the SQL Server service account. It doesn't run in the context of your own login. Therefore you need to make...
January 22, 2020 at 11:24 am
Difficult to help without table DDL or sample data, but try this. You should be able to tweak it if it doesn't work out of the box.
SELECT
s.cs_contactyominame...
January 22, 2020 at 11:22 am
As long as the bcp command was actually executed, you're fine. You always get that "Configuration option..." informational message when you change a setting with sp_configure.
John
January 22, 2020 at 11:07 am
What doesn't work? What process are you following? The error message says that the operation isn't supported on the primary replica, so run it on a node that isn't the...
January 16, 2020 at 10:15 am
Yes, you just need a couple more DATEADDs. Start with a base date, say 1999-12-31, and add the appropriate number of years, then the appropriate number of months.
John
January 15, 2020 at 4:06 pm
If it's for storing in a table, don't worry - it'll get stored the same way no matter how it's presented to you. If it's for you to see in...
January 15, 2020 at 3:36 pm
The RESTORE statement looks OK, although I think I'd put an explicit NORECOVERY in the differential restore. My opinion doesn't count, though - it's whether it works when you run...
January 15, 2020 at 11:48 am
Ah, right - it was your IF logic that I was most interested in. If you're worried about performance, you probably ought to convert the function to an inline table-valued...
January 15, 2020 at 11:43 am
Viewing 15 posts - 211 through 225 (of 7,191 total)