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.
0
votes
1answer
66 views
Getting the exact edited data from a column in SQL Server
I have two Tables:
Articles(artID, artContents, artPublishDate, artCategoryID, publisherID).
ArticleUpdated(upArtID, upArtContents, upArtEditedData, upArtPublishDate, upArtCategory, ...
1
vote
1answer
103 views
Installing Full Text Search on SQL Server 2008 R2 Express
I can't for the life of me install full text search on my SQL Server 2008 R2 instance.
Every installer I have tried shows me this:
I've tried:
SQLEXPRADV_x64_ENU.exe
SQLEXPRWT_x64_ENU.exe
...
0
votes
1answer
72 views
Changing data type from DATE to CHAR(10) with a query
I want to alter the date type in a database that has 40 tables from DATE type to CHAR(10) type, without opening the tables and manipulating them in Management Studio. i.e. only with a script/query.
I ...
0
votes
1answer
77 views
Permission Denied Copy [closed]
I am a beginner learning how to load data and I can't figure out why I can't load this data into postgres. I am using postgres 8.4 on MAC OS.
copy tname from '/Users/Shared/folder/file.cxv' ...
2
votes
1answer
50 views
Synchronize Queries Retrieving Sessions And Locks From DMVs
I have a SQL script that I run when I want to see what is happening in the database. The script has many queries that return information from DMVs, but the two I use most are "Requests" ...
3
votes
1answer
168 views
SQL as a Storage Definition Language (SDL)
In my Databases lecture, the teacher mentioned that SQL is not just a data definition language (DDL), data manipulation language (DML) and view definition language (VDL), but also a storage definition ...
4
votes
1answer
198 views
Indexing strategy when using the between operator SQL Server 2008
I have a large table ~25 million rows with the structure
CREATE TABLE [dbo].[rx](
[pat_id] [int] NOT NULL,
[fill_Date] [date] NOT NULL,
[script_End_Date] AS ...
0
votes
1answer
59 views
Query taking long time
My query is taking around 540 seconds to get result.
Please help me to rewrite it.
Query:
SELECT pd.domain, fd.passkeyid
FROM portfolio.domains AS pd,
fabulousdomains.domains AS fd
WHERE ...
0
votes
1answer
64 views
Delete with subquery with no unique columns
I have a table LIKES (ID1, ID2). Both id1 and id2 are non unique columns.
Database is SQLite
delete from LIKES where ID1 = 10 /// Wrong there more then one record with ID1=10
delete from LIKES ...
3
votes
2answers
127 views
DB2 error - SQL Statement too long or complex
Getting this error in a DB2 production system:
ERROR [HY000] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0101 - SQL statement too long or complex.
The statement has a large number of OR ...
4
votes
1answer
93 views
Designing Simple Schema for Disaggregation of Demand Forecast
I am doing a simple database design task as a training exercise where I have to come up with a basic schema design for the following case:
I have a parent-child hierarchy of products (example, Raw ...
1
vote
1answer
103 views
Struggling with complicated date query
So I have been tasked to write a query involving dates for a contract management system we have. The database stores the date the contract's primary terms expired, the frequency that the contract ...
7
votes
1answer
213 views
selecting more fields causes catastrophic failure
I have a connection to a linked server from sql server 2012 to pervasive sql.
When I do select field1, field2, field3 from mytable everything works!
However, when I do select field1, field2, field3, ...
2
votes
1answer
32 views
Best Practices. Do you append to the existing backup setup when doing a Transaction Log backup?
When doing transaction log backups, is it best practice to just keep appending to the same file or creating a new .trn file for each backup?
Thanks.
1
vote
3answers
306 views
Detecting SQL Server Utilization with a query
My current project will send queries to an sql server constantly and It may use 100% of the memory or CPU.
How can I check if the server is nearing full utilization in a stored procedure so that I ...
0
votes
1answer
141 views
Copy files using script to a network share
Is there a simple script I can use to copy files in a particular folder to a network share? This is for use with SQL Server Agent so I can run it as a step after backups.
Thanks
0
votes
0answers
54 views
Monitoring calculation in xDB replication server in PostgreSQL
I am using PostgreSQL 9.2.
I have installed xDB replication server through stack builder.
I want to know the how much the server slave is lag behind the master.
Master - 192.168.1.2
Slave - ...
2
votes
3answers
66 views
SQL Update Efficiency and Blocking Concern
Say I have some SQL similar to the below, which is an update with many joins. The number of rows actually being updated may be 1000's or potentially only a few. The actual join takes a long time as ...
3
votes
2answers
188 views
MySQL | Complex (for me) SQL Statement, how to?
I have a table that contains posts and another table that contains meta options for each post in first table. The meta options table is a key value pare table.
Lets say I have the posts tables that ...
0
votes
3answers
116 views
Transaction in SQL Server
Consider a scenario, when 2 Stored Procedure called inside a Stored procedure like follows.
Note: All 3 SP’s are implemented with TRANSACTION.
CREATE PROC [dbo].[SP3]
AS
BEGIN
BEGIN TRAN
EXEC ...
0
votes
1answer
57 views
Any issue in referencing a unique index from a foreign key table?
Is there any concern in referencing a unique index from a foreign key table?
Using SQL Server 2008 R2
Please advise thanks
0
votes
1answer
101 views
How to return different statements in where clause ? (oracle)
I mean:
CREATE OR REPLACE FUNCTION FUNCTION1(ID IN NUMBER) RETURN NUMBER
BEGIN
SELECT COLUMN1, COLUMN2, COLUMN3 FROM TABLE1
WHERE COLUMN1<= Y AND (CASE WHEN ID < X THEN COLUMN1<COLUMN2 ELSE ...
1
vote
1answer
158 views
Efficient query plan for selecting all data duplicated on several columns
The flavour in question is PostgreSQL, but it is a generic enough query pattern that your techniques for optimising against other RDBMs should help as well.
The purpose of the query is to show all ...
5
votes
4answers
179 views
SQL Server 2008 and extended properties
In SQL Server, what do you guys use extended properties for? Some articles and blogs are suggesting they be used for self-documentation of the database and its objects but I can't see this being used ...
3
votes
1answer
85 views
Aggregating statistics from child rows
I have a parent row and then many child rows, and I must aggregate statistics from these child rows.
For a more concrete example let's imagine I have one round of golf (parent row) and then child ...
2
votes
1answer
142 views
Optimize simple query in SQL Server
This should be a quite easy query, but I honestly think its execution time can be improved.
select idTag,MAX(pctimestamp) AS PCTIMESTAMP,getdate() AS NOW, datediff(SECOND,MAX(pctimestamp),getdate()) ...
0
votes
1answer
313 views
how to return table on sql function
I am very new to sql create function
i wanted to check data column value at table
the purpose is to return full table where data is null , <0 , >1
the problem is i am trying make data is ...
4
votes
1answer
483 views
temporary table inside procedure oracle
I'm in a situation right now. I'm migrating several procedures from Mysql 5.0 to Oracle 11g.
Mysql procedures allow me to:
1. Create temporary tables
2. Insert data into temporary tables / Query these ...
2
votes
1answer
172 views
SQL INSERT Query takes 2 seconds and sometimes much longer to execute
I know the question's title is bad, But I have an hard time figure it out my self...
sometimes this query runs in 2-3 seconds and sometimes it's takes even 30 seconds
I have a table named ...
6
votes
1answer
122 views
selecting where two columns are in a set
This might be a silly question, and my suspicion is that I can't do this, but is there a construct in SQL that would allow me to do something like the following:
SELECT whatever WHERE col1,col2 IN ...
3
votes
1answer
160 views
Different Results From sys.databases As Different Users
We have a SQL Agent job that is configured to run as user "dbo". This job gets a list of databases defined in sys.databases that match a naming scheme. The job then performs some dynamic SQL to ...
4
votes
1answer
525 views
How to force drop database in SQL server 2008
I'm trying to force drop a database, but after dropping the database, when I try to recreate the database, I'm getting the error "cannot create file C:\Program Files.....[databasename].mdf because it ...
0
votes
0answers
104 views
MySQL Left Join Select all rows
Hi guys I have a query which is pulling data from database :
SELECT sandwich_table.id,
`sandwich_name`,
salad,
COUNT(salad),
salad_type.type,
...
0
votes
0answers
79 views
Try to find a match using SUBSTRING(SHA1(value)), 0, 6)
I have a tbl where all entries for companies that participate in a online project are saved. This table is named "business". Those companies can use their employess to access the online platform i 've ...
0
votes
2answers
40 views
SQLQueryTableData-Important
In SQL Server Management Studio, when I run the query
select * from tablename
it shows me the data.
But, that table is not physically present in that database. Is it possible?
0
votes
1answer
52 views
sql job cancel triggers failure notification
When I cancel a sql agent job running an ssis package, I get a failure email because I set up the notifications to email when the Job Fails.
Does anyone know why this is considered a 'failure'?
2
votes
2answers
95 views
Open source and commercial tools to build dynamic queries of fact tables in star schema
What user interfaces or tools (commercial and/or open source) can query a star schema model (Ralph Kimball dimensional model)? So for example, if we have X fact tables, and Y dimension tables, and Z ...
4
votes
1answer
71 views
comma delimited column fix
At my current place of employment someone made a decision to put IDs into a comma delimited column. I'm looking to break these out into a proper many to many relationship. However; it is not in the ...
5
votes
1answer
77 views
Efficiently Filter Large Set With Disjunctions
Let's say I have a single table
CREATE TABLE Ticket (
TicketId int NOT NULL,
InsertDateTime datetime NOT NULL,
SiteId int NOT NULL,
StatusId tinyint NOT NULL,
AssignedId int NULL,
...
1
vote
1answer
95 views
Change SQL Server 2008 name
I want to change my SQL Server's name.
Currently I am connecting to SERVER1\SQLSERVER. SERVER1 is the machine name. I want to change it so I could connect to SERVER2\SQLSERVER and keep SERVER1 as the ...
5
votes
2answers
460 views
How export a sql server 2008 diagram to PDF filetype?
I want to have a export from my database diagram to PDF or image types.How can I do this?
I worked with sql server 2008 R2.
1
vote
2answers
204 views
MySQL case sensitivity for table names
Why is it that different platforms (linux vs windows) does not support the same naming conventions? I'm stunned by the fact that the documentation uses file names as an excuse for this.
Yes, windows ...
0
votes
1answer
153 views
Get ticket sales and reservations grouped by time slot
Ok, I am definitely no guru when it comes to SQL, I will preface this by saying that. Also, hopefully the info I post will be enough for those out there to figure out what I need to do. That being ...
2
votes
0answers
469 views
Error 9001, Severity: 21, State: 1 The log for database 'DB_NAME' is not available
I have a SQL Server 2008 R2.
I got a mail that the backup had failed, I opened the SQL log viewer and started browsing.
And i found these two errors a bunch of times.
error 1:
Date ...
-1
votes
1answer
323 views
how to sum column values with same id [closed]
with this query :
SELECT a.nid, a.stock, b.qty
FROM uc_product_stock a
INNER JOIN uc_order_products b ON a.nid = b.nid
I have the following result:
nid stock qty
11 256 4
11 256 ...
2
votes
2answers
96 views
Using data from other database to populate a new database
I have a SQL Server database DB1 and want to move data from DB1 to DB2. But only want some of the data to be moved.
I want all the rows from DB1 that have a catParent that is the same as I Id from ...
2
votes
6answers
85 views
MySQL join two table if second table is not empty
I have 2 tables like below
table 1: users
id name
1 John
2 Jane
3 Mery
4 Alpha
table 2 : notes
id note owner created
1 alpha alpha 1 2013-02-03 10:30
2 yeah ...
0
votes
1answer
187 views
Many to Many and Weak Entities
I have an entity that cannot exist without being defined by another, and I want this entity to participate in a many to many relationship.
Example: An artist has an album (the album cannot exist ...
2
votes
2answers
77 views
SQL Server: reset all database tables
I have a SQL Server 2008 R2 database with about 60 tables and around 300 columns. I want to reset all the data and auto increments, I found a question somehow similar but the answer there is to ...
3
votes
1answer
100 views
Dissecting Joins
Recently I asked a question in dba.stackexchange the question was about data hierarchy in sql and a guy named chris allen answered the question and I really loved it but when I try to understand that ...




