An acronym for "Structured Query Language", SQL can be used in relational database management systems (RDBMS) to query, update, delete, and insert data as well as modify the structure of the database. It can also be used to manage schemas and data access privileges.
2
votes
0answers
99 views
Cannot connect to SQL Server 2008 after updating the service pack
After updating, whenever I start the service of the server in configuration manager, it always stops then.
And I found the error in the log
2013-04-13 19:08:19.63 spid7s Error: 15174, ...
0
votes
3answers
53 views
sql:space at the end of string
I have a sql code like shown below
declare @str nvarchar(max),@i int
set @i=0
set @str='abc '
declare @tbl Table(a nvarchar(max))
insert @tbl select @str
while (select a from @tbl)<>''
begin
...
1
vote
3answers
82 views
Can I make sure two columns dont have the same value
If I have a table that looks like this
CREATE TABLE foo (
id INT NOT NULL AUTO_INCREMENT,
aa INT NOT NULL,
bb INT NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY (aa, bb),
CONSTRAINT aa_ref ...
3
votes
2answers
41 views
How can I improve this nested MySQL query to avoid redundant WHERE statement?
I am trying to improve on a nested MySQL query, using the following table structure (omitting a few dozen not relevant to my question):
tbl_users:
ID | email (all subscribers to our email list)
...
6
votes
1answer
175 views
How do I optimize large table so queries that target only recent data perform optimaly?
So I have this table that is ever growing. Most queries are targeting just recent data, say one month old. I suppose this is common problem but I have no idea how it can be solved.
I am open to ...
2
votes
4answers
69 views
What is the best permissions to set for only creating and managing own databases?
I want to create a login for a new user who could only create and manage their own databases. Other databases on the server should be read-only to that user. What would be a good set of ...
0
votes
2answers
84 views
Use CASE to select columns in UPDATE query?
I can use CASE to choose which columns to display in a SELECT query (Postgres), like so:
SELECT CASE WHEN val = 0 THEN column_x
WHEN val = 1 THEN column_y
ELSE 0
END AS ...
2
votes
1answer
45 views
Show all results for past N “insert batches”
Every once in a while I have several users check in with some value:
+-------+-------------+------+---------------------+
| id | user | RT | time |
...
1
vote
1answer
41 views
One call to `decryptbypassphrase` for decrypting all columns
If I use ENCRYPTBYPASSPHRASE to encrypt the full table then how can I decrypt full table easily by using DECRYPTBYPASSPHRASE?
Actually I have to use DECRYPTBYPASSPHRASE ('passphrase', column_name) ...
0
votes
0answers
52 views
Insert performance deterioration over network
i have a strange issue with a windows application (in delphi) running on a win7 client.
The application has a loops and inserts rows on a SQL Server table.
It's simply an insert statement, repeated on ...
7
votes
2answers
185 views
Individual queries run on 10ms, with UNION ALL they are taking 290ms+ (7.7M records MySQL DB). How to optimise?
I have a table that stores available appointments for teachers, allowing two kinds of insertions:
Hourly based: with total freedom to add unlimited slots per day per teacher (as long as slots don't ...
1
vote
1answer
60 views
dead lock when updating
Update Operation.TrTable
Set RecordId = RecordTABLE.newRecordId
From Operation.TrTable tr
Inner Join (
SELECT r.Id AS newRecordId, r.KeyM AS MappingKey
From ...
1
vote
1answer
46 views
Get the list of all Tables, Views, Stored procedures that are not added in a publication for replication
How do i get the list of all Tables, Views, Stored procedures that are NOT added in a publication for replication?Can you help me to make the stored Proc for that?I am new to Replication....Thanks
1
vote
1answer
65 views
SQL Index order and performance based on cardinality and data
I've been working quite a bit on a query that's not operating very efficiently on a DB2 database. The thing will return up to 30k rows or so and take up to 10 seconds. I've been working on getting ...
1
vote
2answers
86 views
Multiple SQL Server data files on same SAN disk
I'm currently in the process of creating a new database, and have previously only ever used a single data file and a single log file. I've done some research online regarding the benefits of multiple ...
1
vote
1answer
51 views
how to show only changed rows
if want querying the following table :
EventDateTime (DateTime), Host (guid), Flag ( bit)
2013-04-01 05:00, {id-x}, 0
2013-04-01 05:01, {id-x}, 0
2013-04-01 05:02, {id-x}, 0
2013-04-01 05:03, {id-x}, ...
1
vote
0answers
38 views
Database Timeout Error from VB Application
Recently we are receiving so many database timeout error from different servers
we are using vb application -- which will use ODBC connection to connect database - here no problem
when we run the ...
0
votes
2answers
93 views
How do I open local files using heidiSQL?
I'm using HeidiSQL to access my remote MySQL db.
Recently I was sent an .sql file.
Is there a way to open this file using HeidiSQL?
Does anyone know of a better way to graphically view and ...
1
vote
0answers
62 views
Getting LCK_M_S On read committed Snapshot Isolation
I'm getting LCK_M_S on read_committed_snapshot isolation. From my understanding, this isn't supposed to happen since my selects are not placing shared locks anymore.
From my logs, I can see that my ...
0
votes
2answers
55 views
How to Drop Tables using a variable in SQL Server?
DETAILS:
I am trying to create a stored procedure where I can pass a variable table name through from MS-Access to tell SQL Server to Drop a table.
WHY?:
In my Access Database I am running a ...
1
vote
0answers
45 views
Why is this query creating 300+ temporary tables in Mysql?
SHOW global STATUS LIKE '%tmp%';
set @UID = 132;
set @param2 = 'cde';
set @param3 = 20130331;
set @param4 = 'C';
select p.id, p.column44, p.column42, ue.column35, u.id, p.column43, p.column45, ...
0
votes
1answer
70 views
Hash in SQL query
I saw few sql queries with ### appended before and after column name in where clause like
`select a from emp where a.###id### = 1`
What is significance of these hashes?
2
votes
1answer
40 views
SQL Application Role access-control
I have been researching the use of Application Roles within Microsoft SQL Server and was wondering if there is a way to limit a user to only be able to set specific application roles. As I understand, ...
0
votes
0answers
33 views
Huge sizes Replication Tables in Sql Server db, how to deal with?
I've a sql server database that is configured to work with old software, i've no details about the software, but i know that DB uses replication.
the DB size dramatically increases.
When i ...
0
votes
1answer
28 views
SQL Server 2000 trace file extension
Are SQL Server 2000 trace files generated in a .tdf format, the same way as SQL Server 2008 R2?
Thanks
-1
votes
1answer
26 views
Can we see the implementation of oracle built in function through query? [closed]
For example: I want to see defintion of UPPER function in oracle. What will be query for same?
0
votes
1answer
45 views
Why is CDC capture failing due to a missing dbo principal
I am having a problem running the CDC change capture job against some of my test databases.
The error message I'm getting is the following:
Executed as user: NT AUTHORITY\NETWORK SERVICE. Cannot ...
1
vote
1answer
92 views
Moving model database
I have moved the model database by using following method
For each file to be moved, run the following statement.
ALTER DATABASE model
MODIFY FILE ( NAME = modeldev , FILENAME = ...
0
votes
1answer
94 views
Oracle Undo tablespace users
Can anybody help me on "what all users are using the undo tablespace and how much" in oracle database 11g r2. any pointers would be much appreciated.
0
votes
2answers
120 views
Get most recent 100 records from the database
I am using SQL Server 2008, we have one database which contains 150 tables. We have introduced systimestamp DATETIME column in every tables. We do update this column with current timestamp whenever ...
-1
votes
1answer
40 views
what kind of owner to defined when creating Sql server DB for web site? [closed]
what kind of owner to defined when creating Sql server DB for web site ?
I am trying to create db and i need to select owner.
my db will serve aspnet web site and I wonder witch owner will be safe to ...
-4
votes
2answers
133 views
Get Hierarchial Data in Self-Referencing Table (Parents , Childs) [closed]
In the following Fiddle,
sqlfiddle
I will pass a sno and I need all the parents of that sno in a table. And all the children of that sno in another table
Please refer to this question. Since ...
4
votes
1answer
105 views
Moving MSDB database
When I am trying to move msdb database from it's default location (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA) to another drive(E:). After moving the database I am getting ...
2
votes
0answers
115 views
Transform XPath map into XML document using relational data
Background
Most modern databases have XML functions that can be used to extract data in an XML format. I want to avoid the task of manually calling XML functions to extract the data.
This problem ...
0
votes
0answers
44 views
Oracle Alternative to EXISTS EXCEPT
I wonder if there is an equally elegant solution for Oracle for the problem posted and answered here:
Comparing Columns that can contain NULLS - is there a more elegant way?
I can't get this ...
2
votes
2answers
56 views
How to JOIN two table to get missing rows in the second table
In a simple voting system as
CREATE TABLE elections (
election_id int(11) NOT NULL AUTO_INCREMENT,
title varchar(255),
CREATE TABLE votes (
election_id int(11),
user_id int(11),
FOREIGN KEYs
for ...
0
votes
2answers
57 views
Multiple Aliases in an SQL Query
Would it be possible to give a table in MySQL query multiple aliases?
If so how would I do this?
-1
votes
2answers
73 views
Combine two SQL statements to a single statement [closed]
My question is related to SQL. I need to pull values from two different tables. I am not successful in doing that. I am able to join the two tables with only a single condition but not many values ...
2
votes
0answers
47 views
merge replication too big
I have multiple handhelds which sync their data via merge replication. from time to time, new core data is imported on the server-database.
for some reasons I keep the old data in the databse and set ...
2
votes
0answers
125 views
Sybase SQL - Truncation error occurred. Command has been aborted
Need help with below code, as it fails with truncation error
Truncation error occurred.
Command has been aborted.
create table monCacheQuality (
ServerName sysname
...
3
votes
1answer
64 views
Convert SQL Server UPDATE Statement for Use in Oracle
I can not get this UPDATE statement to work in an Oracle environment. It was written for SQL server.
I am looking for some guidance on how to convert it.
UPDATE
SOB
SET
COA = CASE
...
0
votes
2answers
66 views
Exploring and optimizing SQL performance of your system (PostgreSQL and Hibernate)?
Imagine you have inherited some project with extensive usage of SQL queries.
Let us assume that Hibernate is used as ORM and PostgreSQL as database, but thats not the point.
A question is: could ...
3
votes
2answers
71 views
Find all the SP's where a particular column is not updated
I want to find stored procedures where a particular column is not updated.
As an example
SP1:
BEGIN
UPDATE YourTable
SET Foo = @Foo,
Bar = @Bar
WHERE Id = @Id
...
0
votes
0answers
23 views
Ghost replication jobs in replication monitor
Has anyone ever seen and know the cause of this issue? We have transactional replication with pull subscriptions. At 2am this morning it appeared that the job (that runs every 15 minutes) stalled out. ...
2
votes
2answers
185 views
SSIS Data Flow Task Excel to SQL table NULL value will not work for small INT datatype
I have a package that imports excel data into a SQL table. One of the columns in the table is of "smallint" data type and it allows for nulls. The excel file column that has the data that is suppose ...
0
votes
1answer
24 views
Comparing two tables for a UUID change and fix it
I have two tables which I'm trying to reconcile the differences of in postgresql.
Table A is old and needs updating.
Table B is an updated, schema identical version of Table A which I have the data ...
-1
votes
2answers
101 views
Select query having count and variable
I have a table like the one below.
I need to form a select query. I'm going to pass a RefID like
SELECT SNo FROM Register WHERE RefID = 1
And beside the SNo in the Statement, I need to have ...
13
votes
6answers
521 views
Why should an application not use the sa account
My first question ever, please be gentle. I understand that the sa account enables complete control over a SQL Server and all the databases, users, permissions etc.
I have an absolute belief that ...
1
vote
2answers
32 views
SQL Server database backup on Remote site
We have 4 different sites and each site has a SQL Server.
our requirement is to have a SQL Server backup or database(Mdf files) of site 1,2,3 in site 4.
In case of disaster on any of the site we ...
0
votes
0answers
38 views
Prices for database administration tools [closed]
What should be the optimum price of an SQL database administration tool with 16 features including backup status review, server and data configurations, server statistics, disk space review, ...
