How to remove trailing zeros from a decimal (type) value?
Hi Everyone,I would like to 'drop' some trailing zeros from a decimal value, e.g.: 50.000000, and I am wondering how to go about this?The value is definitely of decimal type, and in this instance I...
View ArticleRollback problem
Hello,I have an inline function and it is in the same sql script with some other begun transactions.At the end of the last one, which is the inline function in this case, I have rollback command, but...
View ArticleExcel's _xlfn.PERCENTRANK.INC in T-SQL
Hi all,any idea how to mimic this function in T-SQL? We are on SQL Server 2008 R2. Thanks in advance!
View ArticleDisplay only the date part of a date & time field?
Hi Everyone,I want to display only the date part of a date field which contains both date & time information.For example I have the value '2013-11-14 00:00:00.000' in my result set, and ideally I...
View Articlewrong estimation
I have created filtered index on table:CREATE NONCLUSTERED INDEX [ix_test] ON [dbo].[myTable] (col0 ASC) INCLUDE (col1) WHERE (col2 IN(1,2,3)) ON [PRIMARY] GOcol2 is TINYINT data type.Then i have query...
View ArticleSQL Query to get Project Plan Name and Resource Name from Reporting database...
Can you please help me to write an SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007. Thanks!!
View ArticleSQL Express 2008 to 2012 express upgrade not working
I'm trying to upgrade an older version of SQL Express 2008 to 2012 by first upgrading to (what I think is) 2008 SP3 (10.0.5500.0).The upgrade to 2008 SP3 says it has completed and the version of the...
View ArticleHow to spilt a field in SQL
Hi How can I spilt this field to return only the codes starting with AB? The AB code could be in any position in the column. The length of the numbers are always the same.GW12345 | QW12345 |...
View Articlet-sql 2008 r2 datetime conversion issue
In a sql server 2008 r2 database, I have a column called TransactionPaymentDate. The column is defined as varchar(50). The value in the column looks like '05012014'. I need to compare the value of this...
View ArticleSome tags are not showing in SQL when executing the script as per Date
A) When i am executing below scriptSelect ToP 10000 [T_idx],[T_Tag], [T_date], [T_counter] from dbo.[total] ORDER BY T_DATE desci am able to see all tags with respect to date except some tags prefix...
View ArticleHow would I be able to do a split in sql like the C# split
I have an nvarchar column in my datatable in sql which all look something like...
View Articleselect query with date column
Hi,We are using sql server 2005. Table called 'Transaction' has column called changeDateTime which is of DateTime type. When ever transaction gets changed from front end, this column gets populated...
View Articlehow do i calculate the dates in this scenario
I have a situation here and i am not able to think through it there are 4 date columns in a table and i need to do something like below First Record start date is the start date, and end date is the...
View ArticlePrepping large lists for use with the IN Operator
We frequently have to run a query on a specific listing of comptuer names, typically using the IN Operator and ('Name1', 'Name2', etc.).Am looking for a way both to speed up the placing of the names...
View ArticleMerge Statement
Environment: win7, SQL Server 2008 R2Application: Microsoft SQL Management Studio 2008 R2, Business Intelligence 2008 - SSISCode:CREATETABLE Staging_Table ( id CHAR(9),ssn CHAR(9)NOTNULL,Fname...
View Articleconvert rows ro collumns
I have this data, where number of rows can be different:select '' col1 union allselect 'asd' union allselect 'gfrf2' union allselect '2_44ff' union allselect 'ae6754' union allselect 'fff'...
View Articlepivoting multiple coulmn values into multiple columns dynamically
Hi,i have found some topics related to 'pivot' in this forum. but my situation is a lit bit different.I have a table like the belowcreatetable#temp(id int,code...
View ArticleHelp with duplicate rows
Hello,I'm trying to join multiple tables in SSRS report, but I'm not sure how to hide the duplicate rows from the titer table.Currently for each row in the tuber table, it's duplicating same row in...
View ArticleConfusion about SQL UDFs
I created a user-defined scalar function in SQL Server Management Studio that takes two dates and calculates the minimum of the two.When I tried to use the function, I was initially getting an error...
View Article