Special Peformance Tuninig Scenario
Hi I have a special case. I will explain it first and eventually get to the performance tuning issues.I have a datatables with tables that are updating in real time.I need to do two identical series of...
View Articleasp.net database objects list
I am trying to document what are the sql server objects are being calling from the asp.net application.is there any tool , approach or method exists to meet this requirement ?Please mark the post as...
View Articlebcp utility with format file
Hi,I am using bcp utility to create a format file as below:bcp table_name format nul -f formatfile.xmlThis statement giving syntax error.Please can anyone suggest me on this.Thanks in advance
View ArticleT-SQL Empty String without a String Literal
This is just for the fun of it.How might one assign an empty string to an @variable without using a string literal? Here is it with a string literal:declare @myvar varchar(50); set @myvar = ''; select...
View Articledate and GETDATE() issue?
Hi All,this is just to know if the following behavior is expected or a bug of SQL Server 2008 R2.I have a table test with a columntest_date of type DATE. This table has records with different values...
View Article0 in type Bit
Hi guys, regardind the type bit it's correct to say that the value 0 is given only in case of insert 0. I mean, if you insert 1 or 0.3 or -3 you'll have everytime 1, if you insert null you'll have null...
View ArticleHow to write a sql drop table stored procedure based on the table properties...
Hello All, I would like to write a stored procedure to drop tables based on the created date in the table properties, and if a specific word is within the table name, for instance "backup". I would...
View ArticleHow to give a date manually as ModifiedOn
Hey all, I want to give a date example: 3.September.2013 as modifiedOn. I can give day and year as follows. I try all this:MONTH('September'), MONTH(September), MONTH("September"), MONTH(9),...
View ArticleDuplicate rows with multiple 'like' wildcard
HiI have a product table with a title field; example title values could be 'Microsoft Mouse', 'Microsoft Keyboard' or 'Logitech Keyboard'.I want to use a select statement to identify products using 1...
View ArticleHow to use cross apply with openquery (tvf)?
Experts,I was trying to do something like this,SELECT TOP 1 r.Address1, r.Address2, '', r.City, r.State, r.Zip FROM table_name a CROSS APPLY ( SELECT * FROM OPENQUERY(linkedserver, 'SELECT * FROM...
View ArticleGrouping data
How do I concat thisProject Name CodeG450 FSECU Reliability 3 G450 FSECU Reliability 4 Air Data Module (ADV-2012-070) COS 3 Air Data Module...
View ArticleError: String or binary data would be truncated
I have an INSERT INTO query which contains over 100 fields and values; when I execute the query, I get the following error.How do I find out which field is causing this error?Msg 8152, Level 16, State...
View ArticleMoving the decimal
Hi, I have a decimal field (10,4) that has values in it like: 0.0123 0.0063 0.0595 I need a way in my select statement to make them look like: 1.23 0.63 5.95 I've tried this but it's not correct:...
View ArticleHow to expedite delete operation
I have a table format with XML data in varchar max type column, what i am doing is performing a archiving operation for that i need to delete some rows based on date condition daily.but it took too...
View ArticleFunctions help needed.
If I have a value from a column which repeats itself more than once and I want to use the value only once how can i do it ?exampleSuppose someone buys our product in qty of 25 & they pay 5 for...
View Articlerandomly select records
Hello, I have a #TempTable with huge amount of data. For example my table includes product_ID, ProductName, productLoc, User fields. When I Select * From #TempTable I get about 10000 records. I want...
View ArticleXML error in TSQL
Hi,I am trying to run this script which parse a row value into multiple column by ',' SELECT X.I.value('p[1]', 'varchar(MAX)') AS [OutreachActivity_1], X.I.value('p[2]', 'varchar(MAX)') AS...
View ArticleManipulating Dates In SQL Server
It's been a while and I have another issue that popped up.I've been tasked to create an analysis of members who have visited an office less than thirty days after their last visit.So, it's like this; I...
View ArticleCannot resolve the collation conflict between "Chinese_PRC_CI_AS" and...
Hi, Guys:I got this error "Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation."when I run this queryselect * from DimEmployee...
View Articlesum and datediff, help me please I'm frustrated!!!
Create separate select queries to aggregate the SUM of amount field from the dbo.[NAV_dbo_Service Line_V] table using the DATEDIFF function I have to do it in a month to date and year to date...
View Article