how to split xml blobs in to separate columns in t-sql
Hi,I have a urgent issue to work on. Please help me on this query..Here is the XML BLOB need to separate in to different columns in query.EX: XML BLOB <Topic>...
View ArticleHow do I add a unicode "square root" symbol to my output
I have a long paragraph that I want to display in a gridview. The gridview gets its data from sql server. So the sql server string returned could be declared (I hope) as Nvarchar, and then somehow...
View ArticleDeleting Records in Batches wise
Hi All,I need to delete 30 million records in my table.I want delete it batches wise.how to write batches statement for below condition.So i want delete before 2012 data. select * from table where...
View ArticleHow to display a multi-level hierarchy?
I have two tables: EmployeeMaster and EmployeeDetails. The schema of both are as below: Sample data in both tables can be seen via these links. Because of the restriction of uploading only two images,...
View Articlemssql update statement
Hi,I have 2 tables, As you can see, I want to update Table A, but the field to be updated will come from table B. So it depends on Field B1which field should be updated with the value on Field B2....
View ArticleHow to feed a complete table from a fragmented table with good performances
Hi,I need to feed a complete Movements table from a fragmented one. In the complete Movements table I've a record for each year and month. In the fragemented table, from the OLTP system, I could have...
View ArticleOrder of Joins
hello guys, can anybody explain me what is the order of joins when INNER and LEFT joins are combined in one FROM section? here is an example of what I mean:SELECT mo.ProductId ,pd.TextDescription...
View ArticleInefficient statement causing issues
I am running this query, I believe my SQL statement is causing to much overhead and causing the 'System.OutOfMemoryException'. Please advice what I could do instead of performing this complex lookup...
View ArticleSQL Server 2008 timestamp column - excluding column vs using DEFAULT keyword
When inserting into a table that has a timestamp column we can either exclude the column in the column listORWe can specify the DEFAULT keyword for the timestamp column's valueWhich way is more...
View ArticleConditional join question
I am trying to write a query that requires that I join on multiple fields on two tables. The problem I'm having is that I need to join on a field that can have a value that is treated as any by the...
View ArticleGrouping Sets Grand Total and # of Days in Month
My query below is working until it needs to Grand Total on for all Facilities. How would you rewrite this query so that SQL knows to sum all the charges by all the days in the month in the record set?...
View ArticleCreate a Stored Proc DB's On server
HI I have 20 sql servers each server will have near about 50 database , I want to create a Stored proc on each databases can some one help to write a loop and create sample proc on db's @proc = 'CREATE...
View ArticleAnother way to calculate progressive step summing columns
Hi guy, I wish to ask you an advice. I got a table with column NAME, A, B , C, D, E....all the values are integer (except NAME of course). Now I have to do a chart with the different trend from NAME....
View ArticleA loop while that doesn't work...where I'm wrong?
Hi guys, I have this simple code:declare @icur as int declare @imax as int set @icur=1 set @imax=@@rowcount WHILE (@icur <= @imax) BEGIN UPDATE helpino SET incre=@icur set @icur=@icur+1 endbut it...
View ArticleI have problems in SQL Server 2008 R2 with Case Function
Hi,Pleaseguide me later seeing the following link (screenshot) .what I have to do.?Whynotprint the Null value in thefirstcolumnfrom results ?http://axgig.com/images/38530196965917137510.jpg
View ArticleSuggestion for good T-SQL code formatting rules and tools
Dear collegues, I am struggeling with finding a good standard for our T-SQL code layout and indentation. Also, I would like to introduce a tool at our company that does the code layout for you. I have...
View ArticleHelp with datediff
Guys..I need some help with following:I have the following table CREATE TABLE TBL(EQUIPMENT NVARHCAR(255),USR NVARCHAR(255), SYS_STAT NVARCHAR(255),USR_STAT NVARCHAR(255),SYS_STAT_DATE...
View ArticleT-SQL Challenge
I have a problem in framing a sql query (remember I should use stored procedures and at later point of time I need to convert this to LINQ)I have a data structure defined like thisCode Percentage...
View ArticleDisplay email cast table results
Hi, I am creating SP to send email and have email body: SET @body =CAST(( SELECT Time AS 'td','',User AS 'td','',Address 'td','',Telephone AS 'td'FROMTemporary.#Table AS tbORDER BY tb.TimeFOR XML...
View ArticleSPROC Failed on Different Machine?
Hello,I am perplexed by an error I'm encountering.I'm executing a SPROC on my machine, and I get this error: "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON"However, I execute the exact same SPROC...
View Article