SQL Server is a relational database management system from Microsoft. Use this tag for all SQL Server editions including Compact, Express, Azure, FastTrack and PDW.
0
votes
0answers
10 views
What would cause parameter sniffing one one computer and not another?
I just came across parameter sniffing in MSSQL today and used OPTION RECOMPILE to speed up a query that took 2.5 seconds with a parameter vs instant without. On a different developers machine they ...
0
votes
0answers
5 views
How to test changes to a cube?
There is a process in our company built by a long-departed dev that pulls data from a cube stored in a MS SQL Analysis Server (which I typically access via Management Studio). The overall process ...
0
votes
0answers
8 views
Audit logout - high CPU Utilization
Why is Audit Logout taking very high CPU(13K reading on profiler). At this period the whole servers max out on CPU(100%) for like 5 minutes. I need to understand why this is with Audit Logout
1
vote
1answer
21 views
Error Handling in Current and Older Versions of SQL Server Stored Procedures
What is the prefered way to handle errors in 2005+ versions of SQL Server?
And what about versions prior to 2005?
I'm working on some older T-SQL code and I'm finding this expression everywhere:
...
0
votes
2answers
25 views
Algo to find least amount of items that satisfy a given requirement
I want to implement an algorithm for the following problem. It later on needs to be implemented in T-SQL:
I have a set of providers - lets say shops. Each shop has it set of items it offers. Some ...
1
vote
1answer
16 views
large update statement with case and multiple insert / updates in each case
I am not sure how to ask this question but here goes. I am trying to write a procedure to run each night that checks all unpaid invoices for a business and then adds service charge if needed. I need ...
0
votes
1answer
12 views
sql serveur query update cascade
I need to change an the id of 1 table. but the id is use on other tables. So how to create a sql query for update every table at the same time?
UPDATE table1,table2,table3
SET id = 2
where id=1
How ...
0
votes
2answers
31 views
Checkbox in SQL Server Management Studio
I have a form in my application which has several text boxes and I agree checkbox. In database I have to insert the data when a users fill the form. I know how to insert data from text box and other ...
0
votes
0answers
5 views
Authentication box appears when opening office document from sharepoint 2013 document library
I have setup SharePoint 2013 server, where i am facing the issue of Authentication box appears every time I open the office document from document library which is really annoying. Following is the ...
0
votes
1answer
39 views
Combining values from multiple columns into one column
I have a hierarchy structure consisting of A,B,C,D. Each entity has a one-to-many relationship to its child (A -> 1:N -> B -> 1:N -> C -> 1:N -> D).
I have another entity, lets call it X, which can ...
0
votes
0answers
15 views
SQL Server Function Call CLR to sleep
For testing I need to artificially create a slow SQL statement.
I have managed to achieve this on Oracle/Java (details below), but am struggling to achieve the same in T-SQL/VB.Net/SQLServer.
The ...
0
votes
0answers
35 views
Avoiding Deadlocks in SQL with concurrent inserts
I have a process (Process A) which keeps adding records to a SQL table (Table A) (Direct inserts using stored procedure). It is a continuous process which reads the requests and writes to a table. ...
0
votes
1answer
33 views
Check for new/existing values and update in sql
I have a SQL table with Project Column value as 'Project1,Project2,Project3'
I need to update this row if they select a different value like 'Project4' from the telerik dropdown list as ...
1
vote
2answers
24 views
SQL Select random from multiple table and order by specific criteria on one table
I need to select a random record from 3 tables and ensure I am ordering by photoOrder
Select TOP 1(a.id), a.mls_number, a.parcel_name, a.property_type, a.ownership_type, b.filename, b.photoOrder, ...
1
vote
1answer
33 views
Need to add a calculated column to a complex SQL Server view
I'm fairly new to SQL Server and I'm working with a view that is created from a union of 2 select statements that are creating columns in the view and uses inner joins, left outer joins, etc). See ...
0
votes
0answers
22 views
Query all table data and index compression
Does anyone happen to have a generic SQL statement that'll list all of the tables and indexes in a database, along with their current compression setting, for each partition?
Thanks.
EDIT: This is ...
0
votes
1answer
16 views
The SQL Server (MSSQLSERVER) service terminated with service-specific error 1814 (0x716) [closed]
My server tempDB size was around 26 GB, I tried to change the path for this by using below script.
USE master
GO
ALTER DATABASE TempDB MODIFY FILE
(NAME = tempdev, FILENAME = ...
1
vote
1answer
31 views
Update datatype with mixed date and date and time
Our database with a data type of datetime has some entries that are just dates and some with dates and times. For the entries with just dates, can we run a script that will set the time portion to ...
0
votes
1answer
25 views
how to insert then select in one visit to the database without using a stored procedure
I want to be able to insert a row into a table and then select the newly created identity and return that to classic asp (JScript) without having to create a stored procedure. Can it be done?
...
0
votes
0answers
19 views
SQL Select Statement Powershell 2.0 Print Table
I am trying to print a table of people in my database using powershell. I'd like the select statment to return results as XML, and print it to the screen for now. ATM I am having problems printing to ...
0
votes
3answers
70 views
Should I keep this “GlobalConnection” or create connection for every query?
I have inherited a legacy Delphi application that uses ADO to connect to SQL Server.
The application has a notion of a "Global Connection" -- that is a single connection that it opens at the start, ...
2
votes
0answers
100 views
Why does the old value stay in this object after it is reset?
I've shown three programmers this problem and we're all stumped. I call a Sql Server stored procedure in a foreach loop and the result always is the same as the first call. Even if I hard code ...
4
votes
1answer
70 views
connecting to an SQL Server database
I've recently started programming asp.net with C# (using VS2008) and I wrote my first web application that connects to a database. First version worked ok but now there are some problems once I modify ...
0
votes
2answers
18 views
Foreign key linked with primary key in same table
I have a table Categories with columns Id, ParentId (for "subcategories" whom can have any level of nesting) and some other. Using SQL Server 2012 I can't make foreign key in same table, ...
3
votes
3answers
40 views
Should subselects in FROM clauses be optimized into derived tables in SQL Server?
Query 1:
SELECT au_lname, au_fname, title
FROM (SELECT au_lname, au_fname, id FROM pubs.dbo.authors WHERE state = 'CA') as a
JOIN pubs.dbo.titleauthor ta on a.au_id=ta.au_id
JOIN pubs.dbo.titles t ...
0
votes
2answers
32 views
Cascade Delete turned on?
Is there a way to check if the table(s) have Cascade Delete turned on? I'm looking at the script of the table (from SQL Server) and I don't see any indication of Cascade Delete.
3
votes
2answers
57 views
How to create table in SYS schema in SQL Server?
Can one create table in sys schema SQL Server 2008 ?
I know it is possible to mark table as system, but not change the schema.
Any hacks for it ?
-3
votes
0answers
31 views
Is there any reporting software integrated with SQL Server? [closed]
I have database and I want to analyse it and make statistics depending on charts, so,
Is there any software integrated with SQL Server to generate reports and charts?
Any Open source tool, any paid ...
4
votes
7answers
49 views
SqlConnection SqlCommand SqlDataReader IDisposable
SqlConnection, SqlCommand and SqlDataReader all implement the IDisposable interface. I read about a best practice to always wrap IDisposables into a using block.
So, my common scenario for querying ...
0
votes
1answer
13 views
Read Committed Snapshot Isolation and Transactions
I am considering enabling Read Committed Snapshot Isolation on our SQL 2005 database in an attempt to gain some performance. Does setting this isolation level effect all queries regardless of whether ...
1
vote
1answer
48 views
SqlDataAdapter.Fill(DataTable) not filling DataTable
I'm currently trying to retrieve records from a database in a WPF application written in C#. I'm using the SQL data reader and it appears to connect fine but the following is giving me a ...
0
votes
1answer
28 views
Error when accessing SQL Server DB
I have created a WCF web service that hosts on IIS and have an access to SQL Server database. Service working good but those methods that returns custom class objects throwing error in client ...
0
votes
3answers
41 views
Getting the n-th record in the SQL database where the table is result of another query
I have number of users, each taking 10 questions and leave some time stamps. What I ideally want to do is to find the complete time of the n-th user where n is determined by the ascending order of ...
2
votes
3answers
29 views
Update table with constrained values from another table
I'm fairly new to SQL and tried solving this problem for about two days now, to no avail.
The question is, how can I update values in table Table_1 from values in Table_2, considering only specific ...
0
votes
2answers
36 views
Getting Count Only of Distinct Value Combinations of multiple fields.
Please consider the following:
IF OBJECT_ID ('tempdb..#Customer') IS NOT NULL
DROP TABLE #Customer;
CREATE TABLE #Customer
(
CustomerKey INT IDENTITY (1, 1) NOT NULL
,CustomerNum INT ...
1
vote
4answers
66 views
SQL Output Syntax
While I consider this to be a fairly simply query, apparently there is "Incorrect syntax near 'output'". Other online resources have not been helpful in debugging this problem.
What am I doing wrong ...
-2
votes
2answers
52 views
Is it possible to retrieve the sa password from SQL Server 2008 R2 [closed]
My SQL Server have two roles
User
Admin level
I am a SQL Server user not a sysadmin. And I have no permission in access database. So I want to sa (admin) password. Or how to add sysadmin role in ...
0
votes
1answer
8 views
How to get the bounding box from a DbGeography MULTIPOINT?
Sorry if the question is not 100% related to SQL Server itself. But I thought it matches the topic close enough to post it here.
I'm using Entity Framework in my ASP.NET Web API project. While ...
2
votes
0answers
26 views
Sql Server Network Configuration Protocols Not Available
After installing Sql Server 2008 32 bit, I tried to configure it to allow remote access. So I opened the sscm (sql server configuration manager) to set up the protocols to enabled. I did not find any ...
0
votes
2answers
27 views
Stored procedure to not to retrieve null values from table
I have table in which I have hotel names but some columns have Null hotel names. Now I want to get only those columns having hotel names or I don't want to get null column values from table.
My ...
3
votes
3answers
33 views
Read SQL query file from project directory
I've put 3 especially large SQL queries within my Visual Studio project, under a folder "Queries" that is in the project directory (not the solution). Is there an eloquent way to access these files? I ...
0
votes
1answer
30 views
Counts rows returned by query that uses distinct
I have a simple query in this form:
SELECT DISTINCT a, b, c
FROM MyTable
WHERE a = SomeConditionsEtc
etc...
But I need to know how many rows it's going to return. Initially I was doing this:
...
0
votes
1answer
11 views
Add object and its relationships atomically in SQL Server database
Suppose I want to insert a new Experiment in my SQL Server database, using Entity framework 4.0:
Experiment has 1..* Tasks in it
Both Experiment and Task derive from EntityObject
Also, there is a ...
0
votes
1answer
27 views
Generating stored procedures for insert,update and delete automatically
How can I generate insert and update stored procedures for specific or all tables automatically in SQL Server ?
Is it possible ? thanks in advance
1
vote
2answers
35 views
Can busy server lead to deadlocks?
We have a Windows Server 2003 with SQL Server 2005, which at this point often runs into 100% CPU usage. We experience deadlocks sometimes out of the blue. The question - can these be related? Can a ...
0
votes
1answer
44 views
SQL Server product price side by side
SELECT
tbStok.sModel AS Kod, tbStok.sAciklama AS Adı,
SF.lFiyat AS SF, PSF.lFiyat AS PSF,
TL.lFiyat AS TL , USD.lFiyat AS USD
FROM
tbStok
LEFT JOIN
tbStokFiyati ...
0
votes
0answers
11 views
Sql Server - database reporting alerts
I am about to make a reporting/alerting mechanism that will periodically examine state of one of my databases that is constantly updated and send reports/fire alerts if needed depending on the data in ...
0
votes
2answers
17 views
SSIS : how to convert the source column from ID to Value
I'm creating a SSIS package to load data from a CSV file to SQL table. The sample CSV file is
EMP_ID,EMP_NAME,DEPT_ID,MANAGER_ID,SALARY
1801,SCOTT,20,1221,3000
1802,ALLEN,30,1221,3400
I need to ...
3
votes
0answers
40 views
Why is a nullable rowversion column is semantically equivalent to a varbinary(8)?
This MSDN page states:
A nonnullable rowversion column is semantically equivalent to a
binary(8) column. A nullable rowversion column is semantically
equivalent to a varbinary(8) column.
...
0
votes
2answers
55 views
SQL Server Insert with out duplicate
I have a table with millions of records SQL DB. I want to insert a record if new one is not a duplicate record. But I dont want to check whether duplicate record exists. Is there any way to insert ...