I have a table 'images' which contains foreign keys from the tables 'event' and 'category'.
I have a function that displays all the events.
I'm able to select all events that are associated with pics in the images table, but i want to add another condition for category like:
select event from images where category is $category
Is...
I have a SQL server instance that has a Linked server to an Oracle instance on another box. We are receiving the below error.
Msg 7302, Level 16, State 1, Line 2
Cannot create an instance of OLE DB provider "OraOLEDB.Oracle" for linked server "MY_ORACLE".
Any ideas?
...
i have a sql server that has a test pp i have written, this thing is gaining traction and i am worried about loosing data (and the time it took users to enter the data) if the SQL server gets corrupted or someone does something dumb.
i am thinking of what options i have that would do a nightly backup as a maintenance plan, and what i ca...
Hi,
I would like suggestions how to solve the following demand.
I have a table with three fields: EmployeeId, HireDate and DepartmentId.
The EmployeeId needs to be in the following format: yyyyddddxxxx
where:
yyyy - is the year the employee was hired.
dddd - DepartmentId.
xxxx - running number for each department on each year.
...
I have data
Table1
ID Name
-----------
1 n1
2 n2
3 n4
Table2
FID YearS Val
----------------------
1 2008 Up
1 2009 Down
1 2010 Up
2 2000 Up
2 2001 Down
2 2002 Up
2 2003 Up
3 2009 Down
3 2010 Up
I want to return data in following format:...
Sometimes phpMyAdmin generates queries like:
SELECT *
FROM `items`
WHERE 1
LIMIT 0 , 30
I wonder if WHERE 1 has any meaning in a query like that.
...
Is there something like ISNULL() OR COALESCE() but not that checks for null value but for an empty value.
for example:
SELECT cu.last_name, cu.first_name, cu.email, hu.email FROM
(SELECT DISTINCT c.first_name, c.last_name, c.email, c.household_id, h.head_of_household_id
FROM rd_customers c
JOIN rd_households h ON c.household_i...
I've scanned similar questions but they seem to be referring to other databases and/or external languages.
I'm looking to programatically extract table DDL via SQL, with a result that's "good enough" to re-import and reconstruct the table.
DBArtisan produces the exact result I'm looking for, but I have a dynamic list of a few dozen t...
I have a table containing a foreign key and I know the column name of that foreign key.
Is it possible, using this information, to determine the table to which that key links?
The reason for this is that the foreign key is dynamic and so I cannot determine the linked table in advance.
...
I was asked to do a report that combines 3 different crystal reports that we use. Already those reports are very slow and heavy and making 1 big one was out of the question. SO I created a little apps in VS 2010.
My main problem is this, I have 3 Datatable (same schema) that were created with the Dataset designer that I need to combine....
I have a SQLCE table with a date field. Any given date could have one or more records. My client would like the input form to default to the next date (starting from and including the current date) that doesn't yet have a record. I'm having trouble wrapping my head around a query to accomplish this. Googling I've found a couple snippets,...
I'm selecting properties and joining them to mapping tables where they get mapped to filters such as location, destination, and property type.
My goal is to grab all the properties and then LEFT JOIN them to the tables, and then basically get data that shows all the locations, destinations a property is attached to and the property type...
Hi there,
I'm using ASP.NET 4, EF 4 and FILESTREAM in SQL 2008 to add/read files to the DB. I'm able to upload files just fine, but I'm not able to retrieve the files the way I want to. Here's what I'm doing -
I have a grid which displays a list of files. Each line item is a file with a CommandName and CommandArgument set.
The user c...
I have a column in a table that contains a message and I want this message to be displayed in a label. Here is my code which currently doesn't populate the label.
Protected conString As String = ConfigurationManager.AppSettings("sqldirectory")
Dim cnn As New SqlConnection(conString)
Dim cmd As New SqlCommand("select message from [da...
I have to get the month from a column which stores string in format -
Column
----------
`Feb2007'
'Sep2008'
So if the value was 'Feb2007' then I need to get back 2 or else if the value was 'Sep2009' then I should get back 9.
Is there inbuilt function in SQL Server 2008 to achieve something like this?
...
I have a user table in postgress.
Each user can have from 0 to many websites.
I know that it will be waste of memory to bring the user-websites everytime I get the user object from the database and of course I cant know how many websites the user will have.
I could have a table called websites but then I think this could happen again w...
Hello Everybody,
I have been trying to find out total count of rows in each tables which are de-activated.
In my DB I have 20 tables with column IsActive.
I have tried below cursor,however it is getting error saying Invalid object name @Namee.
Create table #t
(
NoOfRows bigint,
)
Declare @Namee Varchar(500)
Declare @GetName Cursor
S...
Hi,
I have a simple table:
CREATE TABLE [dbo].[Users]([Surname] [nvarchar](50) COLLATE Latin1_General_CI_AI NULL) ON [PRIMARY]
with two rows:
Paweł
Pawel
Issuing following select statement:
SELECT *, CAST(Surname AS VARBINARY(30)) AS Expr1, CAST(N'Paweł' AS VARBINARY(30)) AS Expr1
FROM Users WHERE Surname = N'Paweł'
gives foll...
I have something minor, yet very odd happening in SQL Server Management Studio 2005. I have 2 database catalogs which are essentially identical. There is a Market table with a foreign key to other several other tables for example the "Project" table has a MarketID column with an FK reference from dbo.Market. in both db catalogs the Marke...
Here is the log output:
# Time: 100915 13:06:49
# User@Host: ss[ss] @ localhost []
# Query_time: 13.978355 Lock_time: 0.000029 Rows_sent: 10 Rows_examined: 562760
use ss;
SET timestamp=1284574009;
SELECT DISTINCT
SQL_CALC_FOUND_ROWS
B.*,
U.username
FROM sc_users AS U,
sc_bookmarks AS B ...