I've just started working with SQL Server for the first time and I'm having trouble populating test data. I have two tables where one has a foreign key to the other and I would like to be able to insert a new record using the following SQL:
insert into Employee (
EmployeeName,
DepartmentId
) values (
"John Doe",
(select ...
I'm using the following query to return all records where at least 2 conditions match (provided by Quassnoi).
SELECT *
FROM (
SELECT ContentID
FROM (
SELECT ContentID
FROM VWTenantPropertiesResults
WHERE ContentStreet = 'Holderness Road'
UNION ...
SQL Server 2000
Background
I've got a table that stores miscellaneous meta data about a specific course in my course table. The table is defined:
create table course_prefs {
id int identity not null,
crs_nbr int references course (crs_nbr) not null,
fiscal_yr int not null,
group_name varchar(50) not null,
item_name varchar(50) null,
...
I'm trying to efficiently determine if a log backup will contain any data.
The best I have come up with is the following:
DECLARE @last_lsn numeric(25,0)
SELECT @last_lsn = last_log_backup_lsn
FROM sys.database_recovery_status WHERE database_id = DB_ID()
SELECT TOP 1 [Current LSN] FROM ::fn_dblog(@last_lsn, NULL)
The problem is w...
I have a winform solution that I deploy through clickOnce. There is the Main Project and then a Project called psWinForms. That project has a Reference to Microsoft.ExceptionMessageBox that I use in my custom error reporting.
I have psWinForms as a reference in my Main Project with Copy Local = True.
I have Microsoft.ExceptionMessa...
I have a problem with my website. When I publish my site on server, I got an error message:
The database '----------------------------.MDF' cannot be opened because it is version 655. This server supports version 611 and earlier. A downgrade path is not supported.
What can I do about this?
...
I have a table that houses assignment attributes for people and the date ranges that each attribute was assigned for.
The table has the following fields:
PersonId, AssignmentType, AssignmentValue, StartDate, EndDate
Each person has an assignment type of racfId and cmsId which can independently start and end at arbitrary times. What i a...
I have a growing set of Excel spreadsheets none with the same data structure. I need a mechanism to query each of these spreadsheets (DataTables) using a single interface. So essentially, you choose the DataTable from a dropdownlist and then perform your search.
My initial thought was to handle it like this.
Create a generic data str...
I'm trying to use the SQL Server bcp utility to import a text file from a samba share. bcp is choking on the Unix line endings. I'm sure I could add an intermediate step, either on Unix or Windows, to change the line endings to Windows-style. But I would prefer to import the files from Unix without modification.
Anybody know if there's ...
I have a parent and child table and want to create a select statement that, given a parent id, returns a row for that parent and additional rows for every child. Doing a left join is not giving me a row for the parent by itself when one or more children exist. I know this can be done with a UNION but I'm looking for a solution that does ...
Does SQL Server allow you to declare stored procedure parameters like this?
@username NVARCHAR
Or do you always have to specify a size like this?
@username NVARCHAR(100)
...
How do I escape keyword conflicts when NHibernate generates my column names using FluentNHibernate?
NHibernate generated this for me and "Key" is a conflict.
create table Setting (
Key NVARCHAR(MAX) not null,
Value NVARCHAR(MAX) null,
primary key (Key)
)
...
Provided that the tables could essentially be inner joined, since the where clause excludes all records that don't match, just exactly how bad is it to use the first of the following 2 query statement syntax styles:
SELECT {COLUMN LIST}
FROM TABLE1 t1, TABLE2 t2, TABLE3 t3, TABLE4 t4 (etc)
WHERE t1.uid = t2.foreignid
AND t2.uid = t3.for...
I'm studying for the MCTS 70-433 "Database Design" cert, and in the text that I'm studying, one of the self-tests has this question.
You have a stored procedure named
Get_NewProducts. You wish to insert
the results of this stored procedure
into the Production.Product table and
output the INSERTED.* values using the
OUTPUT ...
How to Programmatically Disable Named Pipes in SQL Server 2005 Native Client?
...
Hi,
I was asked to provide an estimation to change a relatively small app designed with MS Access to use a SQL database.
First, is this even possible? I never worked enough with Access, so I'd like to know. If it's possible can you please point me to some websites with tutorials regarding this?
Second: if it's possible, is it recommen...
The INSERT statement conflicted with the CHECK constraint "ck_str_member_no". The conflict occurred in database "C:\DOCUMENTS AND SETTINGS\KARTHIKEYAN\DESKTOP\KOK\DB\INFT3009_ASS1_C3104855.MDF", table "dbo.Members", column 'str_member_no'.
The statement has been terminated.
I am using .MDF file in my visual studio 2008 Express. How do ...
Please tell the query to find out size of the individual databases in the sql server 2005?
...
Duplicate of: http://stackoverflow.com/questions/1496136/how-to-find-out-size-of-the-individual-databases-in-the-sql-server-2005
how to find out log size of each of the database in sql server 2005?
...
Using SQL Server 2000, Date Column Datatype is varchar...
In my table date column values are like:
2009/01/31
2009/02/00
2009/02/01....
2009/03/31
2009/04/00
2009/04/01.... so on...,
I want to display 2009/01/31 instead of 2009/02/00, If date is 2009/02/00 it should display previous date.
How to make a query for this condition?
...