I have a table called city, and a table called city_city. city_city correlates two city records, so it has a fromcity_id and a tocity_id. I can enforce uniqueness on fromcity_id and and tocity_id through a unique key, but how do I enforce uniqueness so that I cant insert a record if fromcity_id and tocity_id are reversed.
For example,...
I have a client that uses a point-of-sale solution involving an Access database for its back-end storage. I am trying to provide this client with a service that involves, for SLA reasons, the need to copy parts of this Access database into tables in my own database server which runs SQL Server 2008. I need to do this on a periodic basis,...
Looking for strategies for a very large table with data maintained for reporting and historical purposes, a very small subset of that data is used in daily operations.
Background:
We have Visitor and Visits tables which are continuously updated by our consumer facing site. These tables contain information on every visit and visitor, ...
Hello,
I don't know if this is the right place to post this but here I go.
I'm working on a project as a student for my internship and I need help. I have a masterPage with horizontal menu items as shown in the attached screen-captured. What I want to achieved is:
Have a default image and description from SQL server database
When a u...
Hi guys,
I have this thing that i need to do and some advices will be greatly appreciated.
I have a SQL server table with some phone calls.For each phone call i have the start and end time.
What i need to accomplish: a stored procedure which for a certain period of time, let's say 5 hours at a x interval, lets say 2 minutes returns the...
Hi all:
I have a table in C#, the data is coming from an Excel file. I need this data to be inserted into a SQL Server 2000 table. I am not to use stored procedures. How do I program it? Any help would be appreciated.
...
This is a simple database security & performance question, but I've always used either a special user (eg. mydbuser), or Windows' built-in Network Service account as the owner when attaching databases to my SQL Server instances.
When deploying my database to a production server, is there a specific user I should stick to or avoid? I w...
I'd like to join on a subquery / derived table that contains a WITH clause (the WITH clause is necessary to filter on ROW_NUMBER() = 1). In Teradata something similar would work fine, but Teradata uses QUALIFY ROW_NUMBER() = 1 instead of a WITH clause.
Here is my attempt at this join:
-- want to join row with max StartDate on JobModel...
hi, i m not able to modify table in SQL server. i m new to databases.
use work
go
alter table employee
modify id varchar(20)
error message is-
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'modify'
here is an screenshot
thanks
...
Hi, This is what I'm trying to do something similar to the following request, but I don't know if it's possible with the SQL-Server syntax:
declare @idClient int
select @idClient=idClient from table
where entite is null and (SELECT * from table where entite=@idClient) is null
Thanks.
...
This site has a technique to pass xml data around in Microsoft SQL Server:
DECLARE @productIds xml
SET @productIds ='<Products><id>3</id><id>6</id><id>15</id></Products>'
SELECT
ParamValues.ID.value('.','VARCHAR(20)')
FROM @productIds.nodes('/Products/id') as ParamValues(ID)
But what is the syntax if I add another field?
The follow...
I've moved database from one SQL Server instance on a machine to another machine completely. Is there any way to forward requests to the new server automatically so it doesn't require client config changes? Keep in mind it's only one DB out of many on the original server so I can't just forward all requests.
...
I am trying to create some script variables in T-SQL as follows:
/*
Deployment script for MesProduction_Preloaded_KLM_MesSap
*/
GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;
SET NUMERIC_ROUNDABORT OFF;
GO
:setvar DatabaseName "MesProduction_...
When I use PRINT statements to debug and monitor long running queries in SQL Server Management Studio, I notice that the output does not appear in the Messages tab right away. Is there a way to flush output to the message tab, or to set up the environment so that it doesn't buffer messages?
...
I have a table in SQL Server, where i want inserts to be added to the end of the table (as opposed to a clustering key that would cause them to be inserted in the middle). This means I want the table clustered by some column that will constantly increase.
This could be achieved by clustering on a datetime column:
CREATE TABLE Things (
...
The current convention where I work is to use SQL Server schemas like namespaces (e.g. Company.Employees, Company.Branches, etc.) Is it possible to get an ActiveRecord migration to use anything other than the default "dbo" schema in SQL Server?
...
I'm asking if it's possible to deploy SQL Server and my database with oneClick setup.
I'm mean that I have to give to my client the setup file that contains my application and my database. The user should just have to click on the setup, and automatically install my application, SQL Server and deploy the database in one operation.
Is t...
I have a db table with about 10 or so columns, two of which are month and year. The table has about 250k rows now, and we expect it to grow by about 100-150k records a month. A lot of queries involve the month and year column (ex, all records from march 2010), and so we frequently need to get the available month and year combinations (ie...
When running a stored procedure, we're getting the error 297
"The user does not have permission to perform this action"
This occurs during times of heavy load (regularly, when a trim job is running concurrently). The error clears up when the service accessing SQL Server is restarted (and very likely the trim job is finished as ...
Hi all,
There are a few posts about this question around but most concern remote debugging - here everything is on same machine.
Visual studio 2008. I have a data connection to localhost SQL Server 2008 using Windows authentication with an admin account - this account is a member of sysadmin in SQL server. I double click stored proc an...