Viewing 15 posts - 31 through 45 (of 55 total)
Hi Nenad,
Yes, this can be painfull. Therefore is better to use the pattern IF NOT EXISTS - CREATE
than IF EXISTS - DROP
. In case of stored procedures it would...
February 25, 2014 at 6:22 am
Hi Carlo,
Thanks for your posts and reminders to batch separator settings.
I referred to GO as a common and widely used batch separator in SQL Server world, not to it as...
February 25, 2014 at 1:30 am
I would recommend BIDS Helper for this task (and not only for this). It's a great extension for business intelligence development studio (BIDS). Here is the link https://bidshelper.codeplex.com/wikipage?title=Variables%20Window%20Extensions
February 20, 2014 at 12:42 pm
DDL? Do you mean direct download link, and if so to what exactly?
No, you need to provide scripts for creating tables from your sample query and fill them with a...
February 17, 2014 at 2:52 pm
You can use SQL Server Management Objects (SMO) to programmatically script out database objects. An intro to SMO scripting you can find here: http://technet.microsoft.com/en-us/library/ms162153.aspx
February 17, 2014 at 1:15 pm
Could you please post the definition of the function? This can help us to focus to problems in your UDF instead of discussing potential problems with any UDF.
Generally, the parameter...
February 16, 2014 at 2:21 pm
Maybe something like this...
WITH cte AS
(
SELECT DISTINCT dbpatid
FROM epsallcontracts
)
SELECT dbpatid,
CASE WHEN
(
(SELECT SUM(LdgAmt) FROM epsallcontracts ec WHERE ec.dbpatid = cte.dbpatid)
=
(SELECT SUM(LedgerAmount) FROM epstransactions et WHERE et.patientid = cte.dbpatid)...
February 16, 2014 at 12:14 pm
Sorry, I did not see the declaration:
declare @Acct int = 1
Then we will just slightly modify the statement from my previous post:
DECLARE @Acct INT = 1;
MERGE @TextTable AS target
USING (SELECT...
February 16, 2014 at 11:57 am
That's nice but do you have any code that actually does what the OP requested? 😉
I guess that the problem was to identify the frist monday in a year and...
February 16, 2014 at 11:08 am
--first Monday of the month
SELECT DATEADD(day, DATEDIFF(day, '19000101', DATEADD(month, DATEDIFF(month, '19000101', GETDATE()), '19000101')-1) /7*7 + 7, '19000101');
--first Monday of the year
SELECT DATEADD(day, DATEDIFF(day, '19000101', DATEADD(year, DATEDIFF(year, '19000101', GETDATE()),...
February 16, 2014 at 5:45 am
This is one case where SQL Server 2014 In-Memory OLTP is successfully implemented.
February 16, 2014 at 5:22 am
The following merge statement replicates text description from the FIRST row in the temmp variable @TextTable to the rows which position is defined in the second table variable @tempTable. From...
February 16, 2014 at 5:11 am
First you can create a function converting a string to table. For instance you can use this one:
CREATE FUNCTION dbo.StringToTable
(
@Input NVARCHAR (4000),
@Delimiter NVARCHAR(1)
)
RETURNS @OutputTable TABLE (val NVARCHAR(50))
AS
BEGIN
...
February 16, 2014 at 4:48 am
If you need details about customers and their running totals for each day you would need a table or function generating one entry for each day. For instance you could...
February 13, 2014 at 1:27 am
DECLARE @t AS TIME = '2:15:00.000';
SELECT
DATEPART(hour, @t) +
(
DATEPART(minute, @t) * 60 +
DATEPART(second, @t) + DATEPART(millisecond, @t) * 1.0/1000
) * 1.0/3600 AS FormattedTime
February 12, 2014 at 2:35 am
Viewing 15 posts - 31 through 45 (of 55 total)