Quantcast
Channel: SQLServerCentral » SQL Server 2012 » SQL Server 2012 - T-SQL » Latest topics
Browsing all 4901 articles
Browse latest View live

Remove cloning of ldf files

Hi Experts,PLease help me in my task where i have to remove cloning of ldf files on SQL Server 2012.I am a novice in such activities.I have tried some of the below methods but all in vain.CREATE...

View Article


software adds comp_companyid that distors my sql results

Hi Folks,i am having the sql below:SELECT TOP (100) SAMINC.dbo.OESTATS.YR as YEAR , SUM(SAMINC.dbo.OESTATS.SALESAMTF) AS TotalSalesFROM SAMINC.dbo.OESTATS INNER JOINdbo.Company ON...

View Article


FOR XML PATH with multiple attributes in child nodes.

Trying to get the hang of querying to XML.Although I can get the result I'm looking for, I'm not sure if it's the recommended way.Here's all the test code.[code="sql"]/*CREATE TABLE Customers(CustID...

View Article

Powershell query to get Availability Group Name

Hi,I am building a powershell script that has a GUI interface for a 2008R2 cluster with SQL 2012 AlwaysOn Availability Groups. I am at the last stage where I am trying to build out the script to force...

View Article

interesting query

I wonder if anyone can help with this query which I cant figure out?I want to limit the amount of rows (or groups) returned, it could be any number but in this case lets say 8 rows, the problem is that...

View Article


SQL 2012 ERROR - The metadata could not be determined because statement...

Hi, This post is related to an error I have discovered through the execution of a SSIS package that has been migrated and upgraded in a SQL Server 2012 instance. The package has failed in initial...

View Article

COMPUTE Clause problem

HI [code="sql"]SELECT SalesOrderID, UnitPrice, UnitPriceDiscountFROM Sales.SalesOrderDetailWHERE SalesOrderID = 43659ORDER BY SalesOrderIDCOMPUTE SUM(UnitPrice), SUM(UnitPriceDiscount) BY...

View Article

Non-clustered Covering Indexes - Many w/few included columns vs Single w/many...

I have several non-clustered covering indexes on a table that have the same key columns with few included columns. I'm wondering if i can just create one NC covering index with all the included columns...

View Article


Trigger FOR DDL_DATABASE_LEVEL_EVENTS

I have this trigger set up and I have one application that is unable to load when logging into the application as sa user.at LoginError was raised during trigger execution. The batch has been aborted...

View Article


Open EDI file in SQL Server

Is there a way to open EDI file in SQL Server and insert the data into tables?Thanks.

View Article

Need help with a query for report

Hi,We have a table in the following format:ServerName ServerFunction BackupReqCodeServer1 IS 0Server2 Ops 0Server3 Ops 2Server4 Ops 4Server5 IS 1Server6 IS 5Server7 Ops 0Server8 IS 2Server9 Ops...

View Article

sys.dm_sql_referenced_entities

Hi buddies!I'm in troubles with a query, when I execute the next statement SQL returns a set of rows:SELECT * FROM sys.dm_sql_referenced_entities('dbo.MySp', 'OBJECT')But, when I use...

View Article

Aggregation and Heirarchy Data type

I want to store an organization Hierachy structure in a table using the Hierarchy data type i've just discovered.Against each level of the organization are numeric values that i want to manipulate....

View Article


conversion explanation requested

Can someone point me to the documentation and or explain why I can not convert a varchar that contains values like .7, 2, 1.3 to decimal(3,1) but I can convert it to float and then to decimal(3,1)?Thanks.

View Article

SQL Server 2012 dtexec execution of catalog package; error output

Using Dtexec for a catalog package and the execution is fine. However, unlike execution from a file location the output for reporting (specifically errors) is stored in the centralized repository. We...

View Article


Searching for a database field in the SQL Server Database

I am new to SQL Server and working on a new Data Base. I need to search the SQL Server database and list all Table names that have a Field I am looking for.In Oracle I would do SELECT column_name,...

View Article

Using MERGE what is wrong with my Stored Procedure

Can you tell me what could be wrong with my SP? I'm using Merge and I'm new to it. What i was hoping is that this query would check to see if a FileName i tried to insert was already there and if there...

View Article


Why is Output parameter null?

Can someone explain why @p2 is null/empty?[code="sql"]begin try drop procedure TestOut end try begin catch end catchgocreate procedure TestOut @P1 varchar(256), @p2 varchar(MAX) OUTPUTas if @p1 = 'Y'...

View Article

VARCHAR(200) vs VARCHAR(2000)

Hi All, Is there any performance difference between VARCHAR(200) and VARCHAR(2000), if input string is not going to exceed 200 characters.

View Article

How will you optimize this Query (having many SELF (LEFT) Joins) ?

Dear All, I have got a small query for optimization and I need your help in it.It is taking 70-80 sec. on production server.Table structure, Query and Execution plan is attached for your reference.Any...

View Article
Browsing all 4901 articles
Browse latest View live