Hi there.
I have a search box where you can enter plain text. The keywords are separated by spaces.
I check each keyword if it fits the format for a date and store 'all keywords' in one array and 'date keywords' in another. All the 'date keywords' are also in the 'all keywords' array, as I can not tell if its 'only' a date or maybe also ...
Hi! I am trying to create trigger on SQL Server 2008. I want that if i update field in tabele log that the new value update field in another table Doc. This is the code for trigger:
Create TRIGGER dbo.DocSt
ON dbo.log
AFTER UPDATE
IF (SELECT COUNT(*) FROM inserted) > 0
BEGIN
IF (SELECT COUNT(*) FROM deleted) > 0
...
This question is pretty much similar to this one, but for SQL Server 2005 :
I have 2 tables in my database:
--'#' denotes the primary key
[Libraries]
#ID #Application Name
1 MyApp Title 1
2 MyApp Title 2
[Content]
#ID Application LibraryID Content
10 MyApp 1 xxx
11 MyApp 1 ...
I want to update a row in a table by incrementing by one the integer value of one of the field..
The current doesn't work, why?
Update htmIndex SET numObs = numObs+1 where ...
...
Hi My company is deciding for switching its existing application to azure platform (only Sql Part). So we need to upload our db from local to cloud. For migration i came across various tools like
1. cerebrata 's tools
2. SqlAzure Migration wizard
3. Microsoft Sql Data Sync
4. Conventional Script way via management studio.
But all the a...
Is it possible to craft an ORDER BY clause to ensure the following criteria for two fields (both of type INT), called child and parent respectively for this example.
parent references child, but can be null.
A parent can have multiple children; a child only one parent.
A child cannot be a parent of itself.
There must exist at least one...
Hi,
I have a table in sql server 2005 which holds an ip range and the corresponding info (country / city / etc). There are approximately 3 million rows and it currently takes just over half a second to return a record based on the query below.
DECLARE @ip BIGINT
SELECT @ip=3561360969
SELECT TOP 1 id, ipfrom, ipto, countrycode, countr...
Hi,
I have the following stored procedure.
ALTER PROCEDURE [dbo].[spList_Report]
@id INT,
@startDate DATETIME = NULL,
@endDate DATETIME = NULL,
@includeStatus1 BIT,
@includeStatus2 BIT,
@includeStatus3 BIT,
@includeStatus4 BIT
AS
SET NOCOUNT ON
SELECT *
FROM
tblProducts as products
WHERE
p...
I think there are some steps to enable SQL Cache Depdndency :
Enabling notifications, changes in web.xml and then using Cache Dependency object.
Please help how do I pass through them ?
...
Is there a better way to write this SQL query?
SELECT *, (SELECT TOP 1 columnB FROM mytable WHERE mytable.columnC = T1.columnC ORDER BY columnD) as firstRecordOfColumnB
FROM
(SELECT * FROM mytable WHERE columnA = 'apple') as T1
Notice that columnC is not the primary key.
...
I have three tables. Product, product categories and product category links. The links table is there as a product can be in more than one category.
What I am trying to achieve is a list of ALL the categories with an additional field which states whether for that specific product id, if the product is in that category.
SELECT *, l.prod...
I think its quite usual task, but still solutions I saw look not so nice.
For example in Qt used approach based on MVC pattern -- you must assign all connections manually.
Or I remember one PHP engine where pages were creating from DB schema.
Which are other approaches? Which one you are prefer? What are the best practices?
...
Trying to store property of C#/.NET type byte[] in SQLite. Here is my mapping:
<class name="MyClass" lazy="false" table="MyTable">
<property name="MyProperty" type ="BinaryBlob" access="property" />
</class>
In SQL server it works like a charm even without the explicit type="BinaryBlob" in the mapping. In SQLite I've tried various ...
I have a table:
id:int
revision:int
text:ntext
In general I will need to retrieve the latest revision of text for a particular id, or (considerably less frequently) add a new row containing a new revision for a particular id. Bearing this in mind, it would be a good idea to put indexes on the id and revision columns. I don't have a pr...
In my database, I have a lot of courses that are compulsory. Some are elective. However, there are courses of a third kind: A list from which you have to choose X courses. The list (and the number X) is different for each study program. How would you represent this relationally?
...
Hi All,
This is probably a stupid question to most of you but I was wondering whether you can rename a column using the 'AS' keyword and a select statement?
Here is my SQL:
Select Main.EmpId
, Associate_List.costCenter, Assignments.Area
, Main.Assignments_1 AS (
Select Assignment_Name
from ...
There is a text field called myDate. This field can contain either 1) 'Fiscal year ending someDate' or 2) 'dateA to 'dateB'.
In situation 1), I want to set the field date1 = to someDate.
In situation 2), I want to set the field date1 = dateA and the field date2 = dateB.
All the dates (someDate, dateA, dateB) can be written as 1/1/2000...
I know how to get the columns from a table using the following SQL statement:
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE (TABLE_NAME = 'MYTABLENAME')
But how do I just return what the UNIQUE Key's Column name?
...
if I just need 2/3 columns and I query SELECT * instead of providing those columns in select query. is there any performance degradation regarding more/less I/O or memory ??
the network overhead might be present if I do select * without a need.
But in a select operation does the database engine always pulls atomic tuple from the disk ?...
I have a SQL Server 2005 database with several tables. One of the tables is used to store timestamps and message counters for several devices, and has the following columns:
CREATE TABLE [dbo].[Timestamps] (
[Id] [uniqueidentifier] NOT NULL,
[MessageCounter] [bigint] NULL,
[TimeReceived] [bigint] NULL,
[DeviceTime] [bigint] NULL,
[Devic...