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).
0
votes
0answers
3 views
Which is Better more rows or more col in Student Attendance Table in mysql?
I want to create an attendance table for student Attendance which structure should I go for?
I have two options.
1) Att(Stud_id,date,is_absent,reason)
2) ...
8
votes
4answers
199 views
Trying to find the last time that a value has changed
I have a table that has an ID, a value, and a date. There are many IDs, Values, and dates in this table.
Records are inserted into this table periodically. The ID will always stay the same but ...
4
votes
1answer
1k views
How can I assign different random values to each row in a SELECT statement?
Please look at this code:
create table #t1(
id int identity (1,1),
val varchar(10)
);
insert into #t1 values ('a');
insert into #t1 values ('b');
insert into #t1 values ('c');
insert into #t1 ...
0
votes
1answer
51 views
Disabled trigger still fired
I've just run the following t-sql to disable a trigger (with a deploy script wrapper around osql):
disable trigger dbo.trExampleTableInsert ON dbo.ExampleTable
In SSMS I could see the trigger was ...
0
votes
1answer
38 views
Recover data from accidental update
I have done an incorrect update and hence I restored the DB with a backup from the previous day. I have not taken a copy of the corrupted data before restoring the backup. Is there any possibility to ...
4
votes
2answers
39 views
Given two known statements, how can I replicate deadlock?
I have two statements (an update against every row in one table (call it table A) and a delete on another table that looks up rows in table A) that I know are causing occasional deadlocks. It seems ...
1
vote
3answers
15 views
Nonclustered index is faster than clustered index?
Both tables have same structure and 19972 rows in each table.
for practicing indexing, i created both tables having same structure and created
clustered index on persontb(BusinessEntityID)
and
...
0
votes
1answer
18 views
Do I need to use -f to fix insufficient max server memory settings?
SQL Server Version:
SELECT @@VERSION;
/*
Microsoft SQL Server 2012 - 11.0.2100.60 (X64)
Developer Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)
*/
Issue:
So, I was playing ...
5
votes
2answers
64 views
What can I add to a server to make SQL restores faster?
I have a 2.8TB SQL database (mostly data files, some 400GB of log files) that currently takes around 9 hours to restore. This database is used for testing purposes and must be deleted and restored ...
1
vote
0answers
16 views
How can I get my linked server working using Windows authentication?
I'm trying to get a linked server to ServerA created on another server, ServerB using "Be made using the login's current security context" in a domain environment. I read that I'd need to have SPNs ...
0
votes
3answers
138 views
Merge Replication identity field issues
One of our clients is using our software with merge replication of a database on a SQL Server 2008 R2 machine. There are two production environments in separate geographical locations only one of ...
0
votes
2answers
27 views
How to properly clean Merge Replication Setup
What is the proper way to completely clean Merge Replication setup ?
I have tried to delete the subscriptions, then delete the publication then "Disable Publishing & Distribution" & delete ...
1
vote
0answers
34 views
How do I maintain more audit history?
I created a SQL Server audit and when I view the audit logs I only see today’s audit. I am saving it to a file and I want to store audit for one year. Is there a way to store database and server audit ...
1
vote
0answers
10 views
How to take partitions or filegroups out of service [migration] [duplicate]
I'm an experienced SQL Server DBA but new to partitioning, and a had a couple of questions. Using SQL Server 2008 R2 Enterprise Edition.
I've inherited a large customer metrics database that grows by ...
4
votes
1answer
88 views
Does Detach/Attach or Offline/Online Clear the Buffer Cache for a Particular Database?
A buddy of mine told me today that instead of bouncing SQL Server, I could simply detach and then re-attach a database and this action would clear the given database's pages and plans from cache. I ...
6
votes
1answer
118 views
How to make trigger code execute only for a specific application?
I was wondering if it is possible to enable a trigger just for my current application and not for any sql executed against the table.
The situation:
There are two applications working on the same ...
1
vote
1answer
43 views
SQL Server giving intermittant connection failures
I have a SQL Server 2000 running on Windows 2003 Server that is giving me intermittent connection failures.
The user connections are getting closed on waiting but mature connections. Meaning when ...
2
votes
0answers
37 views
How to take partitions or filegroups out of service
I'm an experienced SQL Server DBA but new to partitioning, and I have a couple of questions. Using SQL Server 2008 R2 Enterprise Edition.
I've inherited a large customer metrics database that grows ...
4
votes
1answer
122 views
TFS 2012 - Database Project - User with NO LOGIN map to Windows - best practices
I have a SQL Server Database Project (.NET 4.5) in TFS 2012. As a DBA, i'm looking for a mechanism whereby the developers can create 'CREATE USER' sql scripts and assign their permissions within the ...
0
votes
1answer
56 views
SQL Server automatic transaction log truncation
Have looked through msdn but cant find answers to these:
Any help much appreciated:
In simple recovery mode:
Is there any TSQL or alternative functionality that will provide a notification either ...
3
votes
1answer
70 views
Insert performance with Geography column
I've been tasked with inserting data into a SQL Server table with a geography column. I've found that my times for doing inserts (same data 1.5 million rows) go up increasingly.
I started out with no ...
-2
votes
1answer
45 views
Select query using a map [closed]
CREATE TABLE grid_rows(
[row_id] [int] NOT NULL,
[column_id] [smallint] NOT NULL,
[column_val] [decimal](18, 6) NULL
)
// (row_id, column_id) is a composite primary query
For a given ...
0
votes
1answer
53 views
Simplify subqueries with join
I'm trying to create a report in SQL Server Reporting Services that shows the availability of multiple sites. The sites are monitored by a tool that uses a SQL Server 2012 database to store the data.
...
3
votes
1answer
323 views
Database Mail to Distribution List
I have a SQL Server 2005 which I have configured the database mail to setup monitoring alerts and notifications. I also create a email distribution list containing a couple of emails. The thing is ...
0
votes
1answer
27 views
Configure SQL Server Database for High Availability & Warehousing
I have 3 DB servers (DB1, DB2 & DB3 - all on Win 2008 R2 with SQL Standard 2008 R2 in the same datacenter). Let's assume AdventureWorks as an example database.
My goal:
- Setup DB mirroring with ...
2
votes
3answers
59 views
Database design for conditional detail table
I have an expense management system for monthly expenses. Expenses are of two types: one-time monthly expenses, and daily expenses for each day of month. I have created the following tables:
...
6
votes
1answer
121 views
Why does the plan cache contain estimated and not actual execution plans?
I can think of many reasons behind this decision of storing estimated plans in the plan cache and not the actual plan. But I can't find the "correct" answer.
6
votes
1answer
45 views
Index usage stats DMV indicates no index activity
I'm trying to obtain information on indexes. According to several websites, the below TSQL query should join information on indexes to the indexes table, returning indexes and related information. ...
0
votes
2answers
80 views
Bulk Insert through netwok
Can someone help me with these?
BULK INSERT DATABESE01.dbo.TABLE01
FROM '\\COMPUTER01\FOLDER01\TextFile.txt'
WITH
(
FIELDTERMINATOR = ' ',
rowterminator = '\n',
tablock
)
The error ...
5
votes
6answers
340 views
Find procedures that haven't been called in <n> days
We are deleting old stored procedures and tables.
How can I know what procedures haven't been called recently?
dm_exec_procedure_stats and dm_exec_query_stats aren't reliable, since they only return ...
1
vote
1answer
626 views
Login failed for user Error: 18456, Severity: 14, State: 11
I have an AD group XYZ that I have added to SQL Server security with data_reader permissions.
The XYZ group has around 10 users in there who are successfully able to access the SQL Server database. I ...
0
votes
1answer
49 views
PowerShell based SQL script execution [closed]
I am new to powershell. Even I dont think I know the basics..But now I am assigned a work to do the execution of sql scripts residing in a remote server.
1) we have to connect to that particular ...
3
votes
1answer
89 views
Need to divide single column into multiple columns
My table has data with a single column:
1
2
3
4
5
6
7
8
9
10
And I want output like this:
1 2 3 4 5-first row
6 7 8 9 10 - second row
Another has two columns like this:
Column 1 ...
4
votes
1answer
169 views
Allow user to do anything within his own schema but not create or drop the schema itself
I have created a schema in SQL Azure and granted the following permissions to a database role:
CREATE ROLE myrole AUTHORIZATION dbo;
EXEC sp_addrolemember 'myrole', 'myuser';
CREATE SCHEMA myschema ...
2
votes
4answers
123 views
Shrinking the log file does not reduce size
I have a database which had mdf size of 350 MB and ldf size 4.9 GB
When i try to shrink the log file it's not shrinking. I know shrinking a database is not good and it should not be done. But still i ...
1
vote
3answers
619 views
Workarounds for setting default schema for domain group?
I am currently working on a project for a client, they have asked me to change the database from Oracle to SQL Server. So we migrated the database across to SQL Server 2008, when this was migrated ...
33
votes
5answers
6k views
When to use TINYINT over INT?
In general, I always use Ints. I know that in theory this is not the best practice, though, since you should use the smallest data type that will be guaranteed to store the data.
For example, it's ...
0
votes
0answers
19 views
How to delete orphaned records from sysmergesubscriptions table?
I have some old orphaned records for old subscriptions that I want to delete from the sysmergesubscriptions table.
Each time I delete unnecessary records, it show up again after it syncs with any ...
0
votes
4answers
586 views
How can I convert an Oracle dump file into SQL Server?
I want to ask about converting Oracle dump files (.dmp) into SQL Server files (.bak) where during conversion I don't have to be connected to any database server.
I've searched for related ...
0
votes
1answer
43 views
Update performance: clustered versus covering index
I have a simple, 3-column table with about 50 million rows in it. This table gets about 5,000 inserts/updates per second, and perhaps 20 queries per second are executed against the table. The table ...
-1
votes
1answer
36 views
Deleting large chunks of data
create table Grid(
grid_id,
//other columns
)
//grid_id is primary key
create table grid_info(
grid_id,
colulm_id,
column_vale
)
//grid_id is foreign key ...
1
vote
1answer
104 views
Databases list not showing up?
This morning when I logged into SQL Server Management Studio (v 10.0.16) I clicked on the databases node and saw all by db's (they are hosted remotely) as I have done for the last 3 years. This ...
1
vote
2answers
61 views
SQL Server Replication Alternative Software
We have used SQL Server Replication for a long time and had some issues with it that sometimes we needed to reinitialize subscriptions to fix some issues & other times we needed to destroy the ...
1
vote
0answers
114 views
sql server 2008 execution plan different on two production servers [closed]
We have two servers running SQL server 2008 R2, with identical databases, where we implemented a datawarehousing solution. The cube processing operation was taking a VERY long time in one of the ...
2
votes
4answers
229 views
High CPU usage on SQL server - Slow queries [closed]
Our MS SQL Server is using about 95% of the CPU-power.
After a server (hardware) restart, or a SQL-Service restart, the usage is 0% and slowly increases over the course of 1-3 days. Depending on how ...
1
vote
1answer
59 views
How to avoid empty rows in SSIS Excel Destination?
Does anyone have a way to avoid empty rows when using SSIS to export to Excel. Here's a simple example of one data flow task:
OLE DB Source:
Data Conversion (to handle the annoying UNICODE / ...
0
votes
1answer
30 views
how I can create check sum to validate no changes at int string pairs on table
Business case is.
1)Users print document on paper
2)users carry printed paper to Boss, Boss sing on paper
3)after that users going to administrator to digitally sign that paper.
My task is to help ...
8
votes
2answers
268 views
More CPU cores vs faster disks
I'm part of a small company so as usual covering a number of different roles. The latest of which is procuring a dedicated SQL Server box for our .NET web app. We've been quoted on a dual Xeon E5-2620 ...
1
vote
1answer
164 views
SQL Server stored procedure working when run manually, not running from SQL Server Agent
I have a procedure that runs fine using the execute command in SSMS, however putting the same command in a job gives the following error.
line 9, character 9, unexpected end of input
The code ...
4
votes
4answers
2k views
Copy Database option not found in SQL Server Management Studio 2008 R2
I am unable to see the Copy Database option in SQL Server Management Studio 2008 R2.
Can anyone tell me whats going on please?

