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

Not able to set the value for @sql

declare @ sql varchar(150), set @sql = select To_x,Subject,DATEADD(SECOND, Create_Date-14400, ' Jan 1, 1970') from AR_System_Email_Messages where Subject like '%not acknowledged from past%' and...

View Article


Image may be NSFW.
Clik here to view.

Unique Row - 2 different values ! Help Needed!

This may be the strangest thing I've ever seen.We have sql server 2012 and a data warehouse.Fact table contains more than 1 billion rows which are based on monthly partitions.Those 2 queries returns...

View Article


Query join similar fields

Hi All;I need to  shows clients who Are on NEA programme Are on BSUS programmeHave an NEA business start outputDO not have a BSUS business startbelow is my query ion but this query doesnt sattisfy the...

View Article

T-SQL(MSSQL 2005)Reorder Scope_identity

Hello , fellow developers !Have a small table of 2 columns on MSSQL Server 2005 which contains a lot of information let's say about 1 billion records and it is constantly being written into.Definition...

View Article

Nested Recursive Query

I have a recursive query that gets me half way to where I need to be.   The only way I can see to get the result I need is to run that query recursively.Is there a way to do this and then dump the...

View Article


Identity column Jumped/not sequential in SSRS 2008 R2

We are facing uncanny behavior with one of the Identity Specification column on production server database. It's been three times since our application went live on production server. The jump started...

View Article

remove last character from date and format to date

Hi, I have a field (called 'pehPErcontrol') that contains a date value, plus one character. But the value is formatted like this: 201301042 I need to remove the last character (last '2' in the above...

View Article

Converting UTC to Central Time

I have a specific example regarding an issue for which there is plenty of general advice on the Internets. However, when it comes to discussions of space and time, I'm no Einstein. So I guess I need a...

View Article


Simple query having a rate over the medium

Hi guys, I'm tryng to create a simple query who return me the employee with the salary over the average. Using adventure works like sample:select firstname, lastname, avg(baserate) as avgbaserate,...

View Article


PIVOT SQL help

Good Morning all,Currently I have a table that looks like the following:NameType ActivatedEmailDays School Name #1Type #150 70130 School Name #1Type #1360 3601 School Name #1Type #12562562 ... School...

View Article

Tricky Split, Rename column name and transpose to Rows

I have result set like this.SubgroupsAlbania TAX4 2005Bangladesh TAX4 2006Total6847.5Male67.847.5Female68.247.4Urban76.156.4Rural63.644.3And I need to put that into...

View Article

How To: Add an IDENTITY column to This View?

Hi,How to add an identity column to this view:CREATE VIEW [dbo].[MainStatistics] AS SELECT (SELECT COUNT(*) AS EXPR1 FROM dbo.Courses) AS CoursestCount, (SELECT COUNT(*) AS EXPR1 FROM dbo.Certificates)...

View Article

How to handle DISTINCT COUNT against multiple columns???

Here is my problem:  The business requires a measure to be created that involves identifying the distinct count of a field for various columns in specific dimensions.  The field is a store ID...

View Article


Add new column to production table

Hi,I'm relatively new to SQL.  I need to add a column to a key table but there are many users locking the table.  I normally have to as users to log off but I cant imagine this is the only option.The...

View Article

Why SQL Server is not validate the count function numeric argument while I...

First I execute the following query.Selectcount(*) fromsys.objectsI got 76 rowsafter I replaced * as dynamic numeric valuesSelectcount(1234567)fromsys.objectsI got same Resultbut I replaced * as...

View Article


Autogrow of file 'database1.log' in database 'database' took 79342...

Hi all, i am having this issue for quite a while, and nobody is able to help me with this problem.I have a database (10 gb - 10 million row) with default auto-growth setting(10 % , unrestricted...

View Article

Help with Except clause

I have a source database dbtest02 with a table called article with the following dataid           type       cost001         1              40       002         2              34       003         7...

View Article


The multi-part identifier error

I've being trying to figured out why this error is happening but no lucky yet.The code:SELECT CONVERT(VARCHAR, OPER.DATE_OPER, 112) + ' ' + -- DATE OPER YYYYMMDD CONVERT(VARCHAR, OPER.OPE_TIME, 102) +...

View Article

There is already an object named '#Temp' in the database.

run the below sql...I am getting the below error message. May I know what could be wrong here ?There is already an object named '#Temp' in the database.Query IF (Select object_id('TempDB..#Temp')) IS...

View Article

Update Null value based on next record value

Hi,I have a Table as DateName InvNo 10/05/2012aaaaNULL 10/05/2012aaaa111 10/05/2012aaaa111 10/05/2012bbbNULL 10/05/2012bbb456 10/05/2012bbb456I want to update Null invno values with same name/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>