Fill null rows with previous non null value

January 24, 2017
Requirement: In table which has row numbers and need to fill null value with previous non null value.

Solution: Using Cross Apply and Top 1 row

Tsql Syntax (Gen):

Select Coalesce(Tbl1.<Column1>,Tbl2.<Column1>) GTIN,Tbl1.* From Tbl Tbl1 --Coalesce would fetch first non Null Value
Cross Apply (Select top 1 <Column2> from Tbl Tbl2 -- Top 1 value would get only 1 record
             Where Tbl2.Row_Num <= Tbl1.Row_Num and <Column1> is not null --Row_N is row_number
             Order by Row_Num Desc) QE2 --Order by Row_Namber
 

TSQL - Arithmetic conversion error

November 5, 2014
Found a new issue Arithmetic conversion error in SQL Statement. Have been fighting to find issue with Query, finally found solution for the issue. It's Aggregate function Sum. We get Integer column sum as Integer, when values go beyond 4 bite then we get this error.

Solution I found, I have used Sum(Cast(<ColumnName> as bigint)) This resolved the issue.
Continue reading...
 

SSIS: System.IO.IOException: The process cannot access the file

October 16, 2012
Hello All,

Quite interesting thing I got to know today. If your SQL Tools has crashed in between loading. You may be trying to run a package and see above error.

Fix: Simple look for process SSIS Debug Host. This is the process which will lock your file when VS crash in between. Stop the service and you are good to go with re running package.

Cheers,
Raj

Continue reading...
 

SSIS Learnings

October 17, 2011
It's interesting to work with SSIS Case statements in Derived columns.

Secondly today I am really lost, almost having no answer to conditional join in SSIS. Not yet figured whats the soultion. Please share if you have one, or will share if I figure out. I am basically trying to join source column to any of the columns in lookup table.

More detail once I have time :)
Continue reading...
 

Need to know Detailed System Information?

October 14, 2011
Not a problem, just run MSINFO32 in command prompt or run.

You will see all detail information.



Continue reading...
 

List of All DMV, Ref: Another Website.

October 12, 2011
 

DMV in SQL Server 2005 #1. sys.dm_broker_activated_tasks

DMV in SQL Server 2005 #2. sys.dm_broker_connections

DMV in SQL Server 2005 #3. sys.dm_broker_forwarded_messages

DMV in SQL Server 2005 #4. sys.dm_broker_queue_monitors

DMV in SQL Server 2005 #5. sys.dm_clr_appdomains

DMV in SQL Server 2005 #6. sys.dm_clr_loaded_assemblies

DMV in SQL Server 2005 #7. sys.dm_clr_properties

DMV in SQL Server 2005 #8. sys.dm_clr_tasks

DMV in SQL Server 2005 #9. sys.dm_db_file_space_usage

DMV in ...


Continue reading...
 

Some helpfull Queries

October 12, 2011

select  'DBCC Show_Statistics ('''+obje.name+''','''+ind.name+''')' from sysindexes ind
Cross Apply(select name from sys.objects obj where obj.object_id = ind.id and obj.type not like 'S' ) obje

Create Query for all available indexes in table. Execute result set to check Stats on index. Stats update on index in very important for performance of table to retrieve data. Technical: Every time any DML Operation is performed, Index structure is impacted. So it's prefered to u...


Continue reading...
 

SQL Server 2008 Missing Indexes

October 12, 2011
Have ever wondered/concerned what columns are being used mostly. Which tables are queried mostly? whats the number of hits on table? and other concerns related to performance of server.

When it comes to performance tuning we all think of Clustered Index, table partitions, Non Clustered Index, Data retention policy, relationships. In addition to above concern below is list of information I have found in my way of performance tuning.

By reading articles from internet that there are two ways of im...
Continue reading...
 

Windows 7 cannot load Userprofile

January 11, 2011
Hi,
If you ever find any difficulty with Windows 7 login with error message: Windows cannot load User profile.

Trick is to just follow instructions on this link. It helped me fix issues on my computer. Hopefully if you every get into this issue, this might get fixed.

Link: http://social.answers.microsoft.com/Forums/en-US/w7security/thread/9d5c317b-5e16-42ae-9a86-f8ae85761803?prof=required

Regards,
Rajesh

Continue reading...
 

2005 SSAS Range Operator

December 15, 2010
Hi,

In SSAS 2005 MDX we have Range function. This function is very good for any data which is sequential and good for some in some scenario like Date range.

Unfortunately we can't use the same for Amount data like >=50 and <=100. When you have such requirement, I would suggest using Exists function instead of Range operation. In addition using Exists will help using same hierarchy twice once for Min and second for Max.

Will update this post soon with more details.

Keep reading,
Raj
 
...
Continue reading...
 
Make a Free Website with Yola.