Issue with while loop
I have a while loop simple loop - where I am retrieving 10000 records.When I ran in sql server - it has to give me 10000 select statements.. but its giving me out of mry exception.When I retrieve the...
View ArticleTable Valued Function with primary key and spatial index - is this possible?
Good morning,I have tried to find documentation of it but have been unable to. Can someone please tell me if it is possible to add a spatial index to a table valued function?A primary key is possible...
View ArticleHow to get MIN,MAX and AVG time
I have a logic in my Stored procedure ,where I want to check the timings of min,max and avg timings.If (@ID like 'TRE%') BEGIN SELECT @Col1= substri
View ArticleError: Msg 529, Level 16, State 2, Line 4 Explicit conversion from data type...
Hello, Any assistance would be much appreciated!We just upgraded to SQL Server 2014 but when I tried running a good query that was able to run on SQL Server 2005, I get the following error:Msg 529,...
View Articlejson search
we have json getting stored in one of the tables and how can we search inside the json.
View ArticleSELECT timestamp in 20 second intervals
Hello,I have been tasked with the assignment of searching for BOTs in our database. I have 1 SQL table that tracks clicks for each report opened based on USERID. So each USERID represents a report...
View ArticleWhat's the best way of getting this to work?
Hi All,I'm working on an SP that will be run as part of an SSIS package and I'm not sure of the best way of going about getting it working. and I hope I can get some more help up here.The basic idea is...
View ArticleQuery help for getting Hierarchy data
Need help on a query getting hierachy data.I have the following table and data arranged as below.[code language="sql"]declare @tblShop as table( ItemName varchar
View ArticleProcess Cubes Incremental in 2014
Hello,We do have a option called process incremental in 2008 BIDS version. But I couldn't find the equivalent of that in SSDT 2014 or 2012. Whats the best option to use to process cubes incrementallly...
View ArticleExecute a query on DB in Full Recovery Model without write to ldf/log file
Hi,Is it possible to execute a query on a database which is in full Recovery Model without write to ldf/log file?Thanks
View ArticleFastest way to insert the rec in table
I have 2 tables one is dbo.emptemp and another is dbo.empI am trying to join these two tables and see if record is already exists or not in dbo.emp table if exists I don't want to insert it.select *...
View ArticleBest way to randomly select rows?
select SUM(c_amount) from Transactionswhere s_credit_tran_type = 'cash' and b_cancel = 0 and b_credit = 0 and b_failed = 0 and dt_when between '2017-01-01 04:09:54.213' and '2017-01-31 02:09:54.213'The...
View ArticleDelete the duplicate records of table having only one column
Hi all,Kindly suggest or share such query to me , How we can delete the rows having duplicate records Condition; Table having only one column from the we have to delete duplicate recordsThanks
View ArticleHow to know on which column should we create index.
I have a table getcode where it has countrycode,statecode, citycode and zipcode columnsthere are other tables called- city in that city code is PK so automatically it will create cluster index..same...
View ArticleIssue with column - showing as invalid column
ALTER TABLE [dbo].[emp] ADD [ID] INT IDENTITY(0000001, 1)SELECT IR.JournalSource, RIGHT('0000000' + CAST(IR.[ID] AS VARCHAR(30)), 7)INTO #IRTempFROM [dbo].[emp] IR
View ArticleSQL Server GROUP BY one column with a number of columns within the SELECT...
Hello,I have a query that I would like to just group by the (LastInteractiveDate - by day) but not the other columns. Below is my querySELECT DISTINCT &n
View Articlefind a seq_number with more than one day and return the data in the same row
HiI need to do a query that when finds a seq_number with more than one day (day0 to day d62) returns the data in the same row. For example the seq_number 939860789 occurs in 8 days but each data are in...
View ArticleTSQL query help
Hi Experts, Need some tsql help.create table #temptbl ( c1 varchar(100))insert into #temptblselect ', , , , , , , 4.0, 4.0,'union all select ', , , ,4.0, 4.0, 4.0,'union all select ',
View ArticleNeed some help in tweaking tsql logic
Hi Experts, Need some help on tsql logic. I have a small requirement of Archiving msdb job history data into a separate table. In our environment, for some SQL instances, the job history entries are...
View ArticleNeed to determine number of days between dates - getting strange return
I'm trying to develop a purchasing calendar. I have a starting date that is static and a number of cycle days that are also static. If today's date is greater than the start date + cycle days, I need...
View Article