Tagged Questions

Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).

learn more… | top users | synonyms (2)

0
votes
1answer
49 views

how to select first 9 numbers from other table from database using sql query?

I want to fetch first 9 numbers from matching with other column please help me to find out thank you....? SELECT MAINFILE.facno,GLMAST.fglhead FROM MAINFILE INNER JOIN GLMAST ON ...
2
votes
3answers
57 views

Determining which SQL Server tables are accessed over a week?

I inherited a large, pretty-much undocumented SQL Server 2008 R2 general purpose database, used by dozens of different applications. We know many of the tables are no longer in use. Any ...
2
votes
2answers
131 views

Performance Order By large table with Join

Hello I have a table with 206,902 records and I am struggling to improve my query: SELECT TOP (50) [ID] ,[Title] ,[Modified] ,[Created] FROM [Data] Inner Join [Permission] On ...
0
votes
1answer
28 views

Unable to call sp_start_job from website only

I have an agent job that I'm trying to use to kick off an SSIS package via a web page. I have configured my web site running in an application pool as user X. When I invoke sp_start_job as use X ...
2
votes
1answer
52 views

Get a specific row from a TSQL common table expression

I have this tsql code to recursively get the whole workgroup hierarchy for a specific workgroup (WgID 283 here): WITH GroupList(WgID,WgParentWgID) AS ( SELECT WgID,WgParentWgID FROM ...
2
votes
1answer
53 views

How to get all logged in users to SQL Server database for this week?

I'm using SQL Server 2008R2 and I setup a testing database that I need to know who tried logging in so far. Is there a stored procedure or a View or anything that I can gather these type of ...
1
vote
2answers
82 views

SQL Backup tuning large databases

I am tuning SQL backups using compression, writing to multiple files, and changing the BufferCount and MaxTransferSize options. I have SQL instance with a 4 TB database and several smaller databases ...
0
votes
1answer
168 views

Does SQL Server require SSLv3?

We have a Windows 2008 R2 server running SQL 2012 Express RTM (11.0.2100.60). All three protocols (shared memory, named pipes, TCP/IP) are enabled for the server and both 32-bit and 64-bit clients. ...
1
vote
1answer
49 views

Case with multiple conditions

I need to change returned value, from select statement, based on several conditions. I tried something like that: ,CASE i.DocValue WHEN 'F2' AND c.CondCode IN ('ZPR0','ZT10','Z305') THEN c.CondVal ...
0
votes
1answer
37 views

Does view take advantage of table indexes

I have a table with a clustered index and 2 non clustered index. Now, in my view I am selecting everything from my table create view dbo.MyView as Select * from MyTable Now, when I am using this ...
0
votes
1answer
30 views

Type conversion in expression try_cast may affect cardinality estimate in query plan choice

I have a query that is running very slow so I started looking into the Execution Plan. TRY_CAST is a safe way of finding out if the data can be cast to a type. And there is a warning in the plan ...
0
votes
1answer
38 views

Store the resulting list of a SELECT in a variable to count AND use the result

I have stored procedure that uses a cursor and for every fetch a duplicate SELECT, once to determine the number of IDs found (SELECT COUNT(ID) FROM TableA WHERE something.. @cur_var) and if the ...
0
votes
0answers
43 views

SQL Server : error 15208 Level 16, State 1, Line 1

Trying to Backup a certificate from SQL Server causes this error: Msg 15208, Level 16, State 1, Line 1 The certificate, asymmetric key, or private key file does not exist or has invalid format. ...
0
votes
4answers
78 views

DB performance vs replication

I am working on a db optimization (planing for future project growth) and need some help. Currently, every table is using uniqueidentifier as PK (clustered index) and we have high index fragmentation ...
0
votes
2answers
52 views

SQL Server 2012 Very Slow to Consume Memory

I have a bit of a conundrum. I recently upgraded a ~20gb database from Window Server 2008 R2 || SQL Server 2008 R2 to Window Server 2012 || SQL Server 2012. The previous server had 32gb of memory, ...
0
votes
1answer
34 views

Stored proc getting ANSI_NULLS and ANSI_WARNINGS error when executed by application

I have a stored procedure that is getting the following error when executed via an application : Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the ...
1
vote
1answer
51 views

Migrate SQL Server from 2012 to 2014 (11 to 12)

I have just installed SQL Server Management studio 2014 and I also need to update my (local) server to accept a new database via a bak file from a version 12 server. When I look in Server Properties I ...
1
vote
0answers
16 views

Can CDC read through a log file when the agent job hasn't been running?

We currently had CDC running on our SQL server, however, at some point last week the CDC capture job stopped running and started throwing an error. At this point when it stopped somebody had restored ...
0
votes
1answer
31 views

how best to add unique index on nvarchar(max) field on existing table

The situation I find myself in is that I am getting bad data into the database for some reason. I want to preserve data integrity by adding to the User table a UNIQUE INDEX on the UFID field. ...
1
vote
0answers
56 views

Can you speed up this query to aggregate millions of rows?

We store our website traffic data in SQL Server 2005, like so: | Date | IPAddress | GalleryUserID | ThumbView | LargeView | ZoomView | | 2014-11-11 | 192.168.0.1 | 22 | true ...
0
votes
2answers
30 views

Error after removing sql server 2008 R2 Express edition and instaling Entreprise edition: Unable to connect to MyHost\MSSQLSERVER

So I'm having this issue after installing MS SQL Server 2008 R2 Enterprise edition, I'm getting this message error: Unable to connect to WIN7 \ MSSQLSERVER A network-related error or ...
0
votes
1answer
37 views

What does it mean when I see a lock in sys.dm_tran_locks and there's no matching row in sys.dm_exec_requests?

I'm running this query select sessions.session_id from sys.dm_tran_locks locks inner join sys.dm_exec_sessions sessions on locks.request_session_id=sessions.session_id and it consistently ...
1
vote
0answers
19 views

Network connection from old application to SQL Server 2008 R2 lost once in a while

I have put this question on serverfault.com as well, but since the problem concerns connecting to SQL Server, I will also put it here. We are trying to migrate an Axapta 2.5 database from SQL Server ...
4
votes
2answers
110 views

How to store immutable, unique, ordered, lists?

I have an entity with millions of instances. Each instance has to reference an ordered list of items. The lists have to be unique so no list will be stored more than once. But once created, both lists ...
1
vote
2answers
66 views

Are there any special characters that are never allowed in SQL?

I am a Java programmer. We always make database-related things configurable so that they can be easily modified by the DB team as per their requirements. I want to make some queries as configurable, ...
0
votes
0answers
48 views

DBCC error reported

In the SQL Server, I have these errors reported in the error log "Could not export certificate, trying again with random name. If this is a mkmastr build then this is an error." "Creating ...
2
votes
0answers
66 views

Impact of Service Broker on Server Performance [closed]

For DDL auditing we are thinking to use service broker, but I want to check few parameters before deploying it to a production server, where there are about 200 DBs and Standard Edition of SQL Server. ...
0
votes
1answer
56 views

How SQL Server agent calculates next run date for a job

I am developing a system for scheduling task & I am following Microsoft SQL agent approach to schedule task. I have replicated sysschedules table for capturing users scheduling occurrences and ...
2
votes
0answers
77 views

How to insert values into Bridge Table in star schema?

I am modelling my database with respect to star schema with bridge tables. My master Table looks like below. I need to convert this format to star schema. MasterTable StudentNumber | Subject1 | ...
1
vote
1answer
37 views

How to properly restore database from file groups backups?

I have very (from my point of view) strange error while trying to restore SQL server DB from a series of filegroup backups. Here is my corrent config: I have DB with 2 files 2 filegroups and 1 log ...
0
votes
1answer
42 views

DateTime returning with AM/PM

I have a SQL Server database (2008R2) running on a Windows 2003 box. I'm connecting to it using another Win2003 box. When I select a datetime value from the database, I'm getting it back in this ...
1
vote
2answers
82 views

SQL Delete duplicate rows based on column [closed]

I need to remove the duplication of rows based on column to have unique data in this column, additionally I need another condition when the value equal specific information. In my example I want to ...
1
vote
2answers
195 views

SQL Server Grant execute on all stored procedures without ddl permissions

I have some users in my database. They are member of db_datareader. They now also need to have execute permissions on stored procedures. I was just wondering what would happen if one of the stored ...
2
votes
4answers
292 views

Saving a variable globally in SQL server it self and use it when required

We are using ENCRYPTBYPASSPHRASE to encrypt some columns of some database. To decrypt the values every time we need to pass passphrase with DECRYPTBYPASSPHRASE. So I planned to create a stored ...
-1
votes
0answers
24 views

SQL Server Dba backup related [closed]

How can I use a SQL Server database backup with password? Restore that backup by using password all versions SQL Server 2005 and SQL Server 2008 and R2 and SQL Server 2012. Please let me know step ...
1
vote
2answers
50 views

Deciding on a replication strategy

We have several dozen small-medium (<1Gb) databases on our SQL Server 2008R2 (Standard Edition) server, with one or two more being created every month. The server itself is a fairly well spec'd box ...
0
votes
2answers
69 views

Update datatype of primary key without deleting the table-SQL Server [closed]

I have created a table State which my other table, Addresses references. CREATE TABLE State ( StateId varchar(20) PRIMARY KEY NOT NULL, Text varchar(40) NOT NULL ) I want to change its ...
0
votes
2answers
49 views

Can't create table in database with db_owner role (SQL Server 2012)

I have database in SQL Server 2012 SP2 Enterprise. I created new SQL Login and mapped to X database with db_owner role. Now I can't create table on this database. When I run simple create table script ...
0
votes
2answers
56 views

Creating tables with inheritance

I'm fairly new to SQL. I just wanted to create a database from scratch to learn. So I have a table called Addresses and I want to create two tables dependent on it that are Country and State, Im not ...
0
votes
1answer
39 views

Breaking changes between 2008R2 RTM going to 2008R2 SP3?

I have a few A/P FCIs running 2008R2 RTM, and I'd like to upgrade the passive node to SP3, fail over, and then upgrade the formerly passive node. Has anyone else attempted this? Are there breaking ...
0
votes
1answer
38 views

View permission to SQL Server logs on SSMS GUI

I would like to give a user see SQL Server logs from GUI, not through xp_readerrorlog. I was just wondering if this was possible? Thank you.
-1
votes
3answers
86 views

How to load multiple values in cell from Excel to SQL Server many to many table [closed]

I have values in excel like this. StudentNumber| Subjects 1| english, science, maths 2| maths, biology 3| history, zoology I have Student table in database ...
3
votes
2answers
114 views

Change Data Types large Live table

I have a table in SQL Server 2008 R2 with close to a billion rows with Composit PK Column. I want to change the Datatype of Columns from Date to Datetime. Two times ALTER TABLE zzz ALTER COLUMN yyy ...
0
votes
0answers
40 views

How to fix deadlock caused by “X” locks on same resource?

I have the following <resource-list>: <resource-list> <keylock hobtid="72058301601677312" dbid="7" objectname="myDatabase.dbo.TableOne" indexname="PK_TableOne" id="lock2c336fb380" ...
0
votes
2answers
51 views

Solution on a complex sub select query SQL Server

I created a SQL query that requires me to pull data from 2 separate databases, and I noticed that what I did is this: Select *, (Select Z.f From DatabaseZ.TblZ Z where Z.w = A.w) as valueZA, ...
1
vote
1answer
49 views

Script Table Definition in Powershell

I'm writing a powershell to create a duplicate table(in another schema) for the purposes of partition switching*. I'm having problems adding the columns and the clustered column store index. Here's ...
0
votes
1answer
57 views

How vulnerable is SQL Server 2000?

I know there are still some SQL Server 2000 installs that exist out there. With Microsoft no longer supporting these versions, how can I check to see what vulnerabilities remain unpatched? This ...
0
votes
0answers
25 views

query to pull one row per id when multiple rows of each id exist in table [migrated]

I have a table holding email addresses where some people have more than one email address listed. I want to query the table to only pull a single email address per Individual. Columns are: ID ...
0
votes
0answers
10 views

Microsoft.SqlServer.Configuration.Sco.ScoException: The specified driver is invalid

Trying to install SQL Server and I keep getting this error: "Microsoft.SqlServer.Configuration.Sco.ScoException: The specified driver is invalid." Any ideas where to start troubleshooting?
2
votes
1answer
29 views

Copy database wizard-generated job blows up log file; alternative?

I've recently upgraded our deployment environment to include a staging server. Said server has a database on the same server as our production database. I am trying to set it up to copy data from the ...