I'm creating/changing a ton of indexes on a large db. Doing this works if the index already exists.
CREATE UNIQUE CLUSTERED
INDEX [table1_1] ON [dbo].[table1] ([col1], [col2], [col3])
WITH DROP_EXISTING ON [PRIMARY]
But if it does not exist the errors.
So I have changed my script to:
IF EXISTS (SELECT name FROM sysindexes WHERE name...
The following code snippet creates three arrays, which are passed into a PL/R function.
FOR s_id, s_latitude, s_longitude IN
SELECT
s.id,
s.latitude_decimal,
s.longitude_decimal
FROM
climate.station s
WHERE
s.applicable AND
s.latitude_decimal BETWEEN box.latitude_min AND box.latitude_max AND
s.longitud...
I have been tasked with returning a negative selection from our sql database. I'll define the criteria as best i can. Thus far I haven't crafted a query that has worked.
Business Table
[Bus Name] [Bus ID]
Activity Table
[Activity ID] [Bus ID]
Activity Extension Table
[Ext ID] [Activity ID] [Bus ID]
I need the Business names for a...
I have a Data intensive problem which requires a lot of massaging and data manipulation and I'm putting this out there to see if anyone has an idea as to how to approach it.
In simplest form. I have a lot of tables which can be joined together to give me a price listing for dentists and how much each charges for a procedure.
so we hav...
I'm trying to do a query to filter on rows from one table and then join the results on another table and then filter out additional rows.
Here is the query I've written:
SELECT *
FROM (SELECT media.id AS id2, media.flagged AS flagged2, media.item_status AS status2
FROM media
WHERE flagged2 != 'nsfw'
...
I am using Oracle SQL Developer in a linux environment to connect to an SQL Server 2005.
I don't seem to be able to make a sp_help [table_name] call. Previously, I found it quite useful when I was on a Windows environment using SQL Server management, and could make that call.
Is there any way to do this?
[edit] error message returned ...
Problem
In the following query, plr_stations is called twice:
once to limit the WHERE clause; and
once to count the number of results it returned.
The code resembles:
SELECT
m.*,
s.*,
(
SELECT
count(1)
FROM
climate.plr_stations('48.5146','-123.4447')
) AS count_stations
FROM
climate.station s,
climate.measure...
I have the following dilema: My clients (mom-n-pop pawnshops) have been using my mgmt. system, developed with ISQL, for over 20 years. Throughout these two decades, I have customized the app to each clients desire, or when changes in Laws/Regulations have required it. Most clients are single-user sites. Some have multiple stores, but hav...
Ok, so perhaps I'm completely missing something here, but I've just started working with SQL and Android and from what I can see, updates and inserts back to the database need to be handled individually?
I can retrieve a Cursor containing multiple records, but if I wanted to apply an update to each record in the cursor, I can only see ...
Hi,
I am sorting my database depending on date. The date field in SQLite is nothing but a string, stored in the form of dd-mm-yyyy.
How do i carry out the sorting.
My idea is to create a dummy table.Convert the date in a format yyyymmdd. Then sort it simply using sort by date column.Then again drop the table.
Is there an efficient or ...
Hi all,
I'm using one of my MySQL database tables as an actual table, with times of the day as each column, and one column called day. You guessed it, in day it says the day of the week, and in the rest of the cells it says what is happening at that time.
What I want to do is only show the cells that have value in it. In my case, I'm al...
Here's my current query:
SELECT questions.question, questions_headings.title FROM questions JOIN questions_headings ON questions.heading=questions_headings.id WHERE questions.heading IN (1,2,3) ORDER BY RANDOM() LIMIT 10
Basically, the database contains Questions for various Headings. For example:
questions_headings:
+----+-------+
...
Oracle 8 SQL: I do have data like "VTR 564-31 / V16 H12 W08 E19 L14" from which I want to trim the second part => "VTR 564-31"
According to this website I can use the rtrim function
rtrim('123000', '0'); would return
'123'
like this it works, but adapted to my use case, the following one does not trim at all? Do I have to escap...
Hi,
how can I run a MySQL query that selects everything that is not null? It would be something like
SELECT * FROM schedule WHERE ((all)) IS NOT NULL
Do I just remove the all and go..?
SELECT * FROM schedule WHERE IS NOT NULL
Thanks!
...
I don't know anything about it and would like to learn how. I don't know what I need to install or configure, or how to use it. Is there any advice to get started?
...
I am developing a custom CRM solution which will be sold via the Web/SaaS model. I anticipate tens or hundreds of clients using this solution. I will be using MS SQL as the db engine.
Option 1 is to have a single DB, and include a TenantId column on tables, a suitable index and use 'where tenantId={...}' on each db access.
Option 2...
Hi,
I am trying to debug a long stored procedure in Visual Studio 2008. I have followed all the steps on this link:
http://www.sqlteam.com/article/debugging-stored-procedures-in-visual-studio-2005
but I still get the same error... 'Canceled by user' and it never hits the breakpoint.
Visual Studio 2008 and SQL Server 2005 are runnin...
I need to compare integers in a mysql table. Pretty simple, but this table is fairly large... so queries take a long time. No problem, I can use an index. According to MySQL documentation, I should be able to use an index for comparison operators:
"A B-tree index can be used for column comparisons in expressions that use the =, >, >=,...
How words break in the full text indexing process depends on what language you use, right? Now let's say I want to add a breaking character that usually is not, in any language.
Example:
I want words to break at the letter a how do I accomplish that? And let's also say I have a word that I want to act as a wordbreaker, for example th...
My scenario is... I create Table as(id identity(1,1) not null,name varchar(500),category varchar(50))... i try to insert values.. displays has (1,'sede','diabetes') and it goes has 1,2,3. But when i delete the total content.. once again insert it starts with 4,5,6...
I don want this type of inserting...When content i deleted it should s...