Quantcast
Channel: Microsoft SQL Server
Viewing all 4871 articles
Browse latest View live

Error in SQL Server query execution plans

$
0
0

Hello,

I am getting a total cost more than 100% when totaling individual query costs.

This is the query for which I am getting execution plan of 104%.

SQL
declare@datesmalldatetimeSELECTReffdasName,(select((selectcount(*)from[cal_reg].[dbo].[customer]whereupper(Reffd)=upper(main.reffd)andcast(dateassmalldatetime)=@date)+(selectcount(*)from[cal_reg].[dbo].[rep]whereupper(Reffd)=upper(main.Reffd)andcast(dateassmalldatetime)=@date)))asCompleted,(select((selectcount(*)from[cal_reg].[dbo].[customer]whereupper([callAttnd])=upper(main.[Reffd])andcast(dateassmalldatetime)=@date)+(selectcount(*)from[cal_reg].[dbo].[rep]whereupper([CallAttnd])=upper(main.reffd)andcast(dateassmalldatetime)=@date)))asAttended,(SELECT((select((selectcount(*)from[cal_reg].[dbo].[customer]whereupper(Reffd)=upper(...

Alternatives for Server query execution plans

$
0
0


 Hello,
I am looking for the best alternatives of "query execution plans " in MS SQL server.
Can anyone help me in this ?
 

Ask the SQL Server Tiger Team About Query Performance on Twitter Chat Event

SQL Server Experts

$
0
0

Where can I find a reliable SQL server developer with a very quick response time?  I am in CA so I'm hoping to find someone (or a firm) on the west coast.

SQL Server Will not Start Without a Password Reset via System Services

$
0
0

Hello all

I have a challenge with a SQL server instance I configured to run on a mixed mode authentication. Time and again, the SQL server never starts automatically, yet it configured to do so. I am forced to go to the system services, right click the instance name, go to properties and reset the password via the log on pane. It only then that the sa authentication would go through. Interestingly, this is rising when I have not done any password changes on my system since the installation of SQL server. Has anyone an idea of why this could be happening? If so, what are the suggested long term fixes?

Great thanks

SQL Server 2008 R2 - Work out week on week percentage of sales value

$
0
0

Hello,

Im trying to work out how to get the week on week percent value of sales per area.

Data is like

Area, Date, SalesLocal, SalesRemote, DayName, DayOf Week, FinancialWeek, MonthName, FinancialYear

1 2015-04-01 0 50 Wed 4 1 April 2015

2 2015-04-01 null null Wed 4 1 April 2015

3 2015-04-01 100 0 Wed 4 1 April 2015

3 2015-04-01 50 100 Wed 4 1 April 2015

3 2015-04-04 50 50 Sat 7 1 April 2015

and i would like to have it calculate each financial week , so each week is 100% so add each area sales for each financial week and work out the percent for that day of the...

SQL Server Backups

$
0
0

My SQL server backup files are 5GB in size.  Do you think it is okay to schedule two backups a day (one during business hours)?  As of right now, it is only backing up at 1am every morning.

SQL - parsing UK postcode info

$
0
0

Hi guys,

I'm trying to create a function that looks at a postcode, then checks it against a field and returns an ID from another table. The problem I'm having is that the field it needs to look up against contains a list of possible postcodes with wildcards. A good example would be:

Text
N1-99, N1?, NW1?, NW*, BR* 

In this instance, ? represents any alpha character, * represents any character, and #-## represents all numbers between and including # & ## (so, N1 - N99).

I've gotten as far as stripping out the first part of a postcode from a string, but I don't really know the best angle to come at this from. I'd guess the first thing I need to do is break up the lookup list and check each entry individually against the postcode, but I'm at a bit of a loss as to where I should go from there.

I've attached a list of IDs and their associated...


SQL script produces error

$
0
0

This is the error I get when trying to run a fairly complicated SQL query:

Msg 1101, Level 17, State 10, Line 8

Could not allocate a new page for database 'TEMPDB' because of insufficient disk space in filegroup 'DEFAULT'.Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup,or setting autogrowth on for existing files in the filegroup.

I have the autogrowth set to on.

SQL Server assistance with Stored Procedures

$
0
0

Ok. So, I've looked everywhere I can think of and I need help, please.

I'm creating a stored procedure that will look through a particular table for a purchase requisition (we call them AVOs) that hasn't had activity for over 3 days. I'm trying to dynamically pick up the person who created it and have this alert send to them. I've got the rest of the script taken care of, but I'm having a hard time getting an idea of how to create a recipient list dynamically based on this parameter. I'd prefer not to hard code it as our sales team does change, but at this point, I just want it to work.

Adding Subcategories to this Sql script for reporting

$
0
0

Hey Spiceworks,

We are trying to get this SQL Script to include Sub Categories as well as all of the items we have defined in sub categories and time worked on each ticket. If at all possible could you also include a generic statement in the event we want to see how to add these catgories or time worked. Thanks (Our Script is below for the current report)

SELECT users.first_name as "Assigned To", count(*) as "# Assigned", tickets.category as "Ticket Category",

round((100.00*count(*))/ ((select 1.00*count(*) from tickets as tickets2 where tickets2.created_at=date('now','-7 days')

)),2) as "percent",

round(sum((strftime('%s' ,tickets.closed_at)-strftime('%s' ,tickets.created_at))/3600.00),2) as "Total Time Open(hrs)",

(select round((sum((strftime('%s' ,tickets2.closed_at)-strftime('%s' ,tickets2.created_at))/3600.00))/count(*),2)...

TSQL - bring back rows even where doesnt exist

$
0
0

Hello,

Have a little tricky query im trying to do.

Basically trying to bring back a product from a vendor between dates and work out percentages and sales.

Now when i bring back data for some months some products wont appear as they didn't sell any, but i would like to include that data but enter value as 0.

below is the script


SQL
WITHDATA_CTEAS(SELECTd.VenID,d.[Des]asSMPtc,d.SID,COUNT(*)ASNumSold,d.Pcode,COUNT(*)OVER()ASTotalSold,COALESCE(MIN(t.ENGCAvg),0)ASENGCAvg,COALESCE(MIN(t.ENGAAvg),0)ASENGAAvg,COALESCE(MIN(t.AAvg),0)ASAAvg,COALESCE(MIN(t.CAvg),0)ASCAvg,d.SMP,d.[Des]FROMr.PRO_DSNdLEFTOUTERJOINr.PRO_AvgtONd.Pcode=t.PcodeANDt.EntityType='Area'ANDt.EntityId=@AreaIdANDt.S=0WHERE(d.AcceptedOnbetween'2016-01-01'and'2016-03-31'ANDd.S=0ANDd.SID=@SID)ANDd.VenIDIN(...

SQL reporting services 2008 toolbar scroll (freeze)

$
0
0

At some point over the last year I think there was an update or change to SSRS 2008.  Before when you would scroll down through a report the toolbar (parameters, VCR buttons, Print button, etc) would stay on the top of the page as you scroll.  Now if a user scrolls to the bottom of the page they would have to scroll all the way back up to the top to hit the print button where before the print button would be right at the top of the page.  Not sure how else to explain this other than the toolbar no longer scrolls with the page and stays at the tippy top of the page instead of scrolling down and staying visible on the page.

Anyone have any idea how to set the toolbar to scroll and stay visible on the page when viewing reports in report server 2008r2?

SQL Server connection error

$
0
0

Hello,

I upgraded my computer to Windows 7 to windows 10 yesterday.

My sql server 2012 was working fine before the upgrade. I was trying to connect to my sql server today.

and I am getting following error message.

TITLE: Connect to Server

------------------------------

Cannot connect to XXXXX

------------------------------

ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-1...

...

SQL Server Backups

$
0
0

I'm a newbie to SQL backups, but only with using the Maintenance Plans.

Before I used a 3rd party tool that my last company wrote themselves.

I'm always thought that if i have enough storage and resources I can just run a FULL backup and then that's it. If i need to restore it's just a case of restoring from that backup. Now, at my new job I have been told that I need to use the "COPY ONLY" option, and what i don't understand is why? I read that the best practice to take is to do a Full backup (say Monday) and then a Differential backup (Tuesday-Sunday) and make sure the differentials are set as COPY_ONLY as if another colleague was to take a manual full backup (say Wednesday) of the same database, between my original full backup date (Monday) and my last differential (Thursday) then when i try to restore my Monday Full backup and my...


SQL Server 2005 error 1603 during installation Windows 7 64Bit

$
0
0

Trying to install SQL Server 2005 on Windows 7 Pro (x64). It was previously uninstalled and working however our client uninstalled it from their device after getting Blue Screen crashes.

Now when trying to install SQL Server 2005 Express Service Pack 4 (or without SP, or with SP3) we get Error 1603.

The file was downloaded from Microsoft Website and is copied on the C Drive. I have tried manually installing using command prompt etc with the same issue.

I know SQL Server 2005 is no longer in support and not officially supported in Windows 7 but it was working fine and it's the only thing that works with the legacy software we are using it with.


Text
Property(S): DATABASE = c:\Windows\Installer\798f0.msi Property(S): OriginalDatabase = c:\532c2f1bfb183c9f06674ded\Setup\SqlSupport.msi Property(S): UILevel = 2 Property(S): ACTION = INSTALL...

How to create a Unique (Index) constraint across multiple tables?

$
0
0

Is there a way to create a unique index across tables in a MS SQL database?

I have two tables, Table A and Table B. In that I have a Column named ID, I want to make these Id columns as unique (combining Table A and B's Ids )

How can I do this ?
Please help me

Service pack apply strategy

$
0
0

Hi Spice Heads,

I have joined in a company as SQL Application Support, Last

month our DBA left the company. I know a bit of SQL like Backup Restore general

connections issues, creating indexes, creating maintenance plans as well.

My manager asked me to apply service pack 3  for sql server 2012 .Currently we are on

Sp1,We have 4 default instances(Prod,Prod Secondary,Test and Dev).We got 10

databases with a size between 10- 80 Gb.

At least 4 databases are in the database mirror from prod to

Prod Secondary,

What is the process of applying service packs?

Can you please guide me?

SQL Merge replication - What happens if the publisher server dies?

$
0
0

Guys,

     I am contemplating moving to Microsoft SQL Replication, I love the peer-to-peer replication but I don't have the budget for SQL Enterprise.

So based on standard edition Merge is the replication type I was looking at.

I will not use clusters nor always on.

The idea is to have a publisher and a subscriber in our lan and then other subscriber in another site accessible via a site 2 site vpn.

I am trying to find out what would be the best practices to bring everything up and running in case of disaster and minimizing the data loss.

Any suggestions or pointers will be appreciated.

We are using SQL 2014

Thanks

What is the best way to do the following:

$
0
0

I have yet to find my answers on this subject. This is exactly what I'm trying to do.

We currently have a system for submitting purchase requisitions. It is held in our DB. I'm only using one table. I'm trying to run a stored procedure that would read through these and check to see if mgrApproval = 'Pending' and QuotedDate is NULL. With these, the information tells me that these AVOs haven't been touched yet. I also have columns that include the number of the requisition, the department it was submitted to and the Employee name.

I'm trying to trigger anything that hasn't been touched in = 3 days, but not older than 3 months. Then take that information, throw it in a table, email it to the specific Employee name. I've found a way to concat the Employee name with our @company.com, which gives us a new column (alias). I'm beside myself.

I...

Viewing all 4871 articles
Browse latest View live


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