Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

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 Article


asp.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 Article


bcp 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 Article

T-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 Article

date 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 Article


0 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 Article

How 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 Article

How 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 Article


Duplicate 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 Article


How 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 Article

Grouping 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 Article

Error: 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 Article

Moving 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 Article


How 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 Article

Functions 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 Article


randomly 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 Article

XML 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 Article


Image may be NSFW.
Clik here to view.

Manipulating 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 Article

Cannot 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 Article

sum 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
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>