Viewing 15 posts - 136 through 150 (of 668 total)
DDL, sample data and expected results will be helpful and get you the results you need
January 22, 2019 at 9:32 am
This is too long and not enough information is provided. Can you please provide DDL and sample data as well as your expected results. The query you have won't work...
January 22, 2019 at 9:25 am
how does date value 737060 to 1/1/2019 ? Are you storing in Excel or SQL Server? What is the datatype in SQL Server? Why are you doing this?
January 22, 2019 at 9:20 am
I tried with CTE and cross apply, but cross apply may need to be changed to full outer join on animal id
CREATE TABLE #kennel_history(kh_identity int NOT NULL,
January 18, 2019 at 2:19 pm
What are the expected results? Try this, just a wild guess
SET @sqlquery =
N'SELECT [week],' + @PivotColumns + '
...
January 18, 2019 at 9:51 am
Do you have an calendar table? Otherwise, you'd have to 'generate' one. I used Jeff Moden's tally table (attached) to generate the dates for 2019 and modified your data to...
January 17, 2019 at 2:11 pm
why are you doing all the subqueries instead of joining to the tables themselves? Every row is running 9 select statements to get data. What is the purpose of the...
January 17, 2019 at 10:49 am
There is no sample data, so I'm not going to generate any, but have you tried Round(AVG([TaktTime],1) instead of AVG([TaktTime]?
January 17, 2019 at 9:01 am
I got this to work by removing Format from the insert and the format file looks like this
BULK INSERT dbo.test
from 'C:\work\data\test\test.csv'
WITH ( FIRSTROW...
January 16, 2019 at 2:20 pm
This is a MSSQL forum. Convert it a MSSQL function. Try cast:
SELECT MONTH(start_date) Month,
DAY(EOMONTH(start_date)) DaysInMonth,
COUNT(*) AS TripsInMonth,
cast(COUNT(*)/(DAY(EOMONTH(start_date))+0.0) as decimal(9,2))...
January 16, 2019 at 8:05 am
just a stupid guess, but what sql version do you have the VSTS Project set to?
January 15, 2019 at 10:51 am
Not sure what this table is for, you could use Sequences
declare @i int
insert into [dbo].[tblOrderNumberLog] default values
set @i = SCOPE_IDENTITY()
select @i
January 15, 2019 at 10:33 am
Why do you need either approach? What are you trying to do? If keyColumn is the PK, then any grouping on it will return 1 row and the count will...
January 15, 2019 at 10:23 am
Have you done any testing? I'd be concerned about your assumption as well. If that doesn't prove true or you delete runs and fails (i.e. blows out the log), then...
January 15, 2019 at 7:06 am
One way is to use Row_Number
select * from (
select *, Row_number() over (partition by ServiceTypeCd order by ServiceTypeCd) RowNum
from [TableOfData]
where SERVICE_TYPE_CD...
January 11, 2019 at 12:13 pm
Viewing 15 posts - 136 through 150 (of 668 total)