Trying to create Database as follows:
USE Master
GO
IF NOT EXISTS(SELECT [Name] FROM sys.databases WHERE [name] = 'QAudit')
CREATE DATABASE [QAudit] ON PRIMARY
( NAME = N'QAuditData', FILENAME = N'<filePath,nvarchar(300),C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\>QAuditData.mdf' , SIZE = 921600KB , FILEGROW...
This is a follow-on question from the one I asked here.
Can constraints in a DB have the same name?
Say I have:
CREATE TABLE Employer
(
EmployerCode VARCHAR(20) PRIMARY KEY,
Address VARCHAR(100) NULL
)
CREATE TABLE Employee
(
EmployeeID INT PRIMARY KEY,
EmployerCode VARCHAR(20) N...
SQL Server supports the ability for clients to store
objects within tables.
Create Field that data type Image and Initialize byte array with a null value initially.Use FileInfo object to get file size.Open FileStream to read file.Use
...
I have a SQL Server 2005 database which contains a table called Memberships.
The table schema is:
PersonID int, Surname nvarchar(30), FirstName nvarchar(30), Description nvarchar(100), StartDate datetime, EndDate datetime
I'm currently working on a grid feature which shows a break-down of memberships by person. One of the requirem...
I am using SubSonic3 with SQL Server 2000.
I have problem with the method "FirstOrDefault" - it always throws an exception = "Line 1: Incorrect syntax near '('." from the SubSonic.Linq dll
EDIT (Added code from comment):
InventoryDAL = DAL project name (dll)
Inventort= Subsonic3 Gnerated classes
Name space WHWarehouses = gnerated ob...
Hi, i have a situation and couln't figure out for this time.Here's the question.
I have a table for accounting. Transactions are stored in this table.
Table Accounting
Plus Minus Flag
100 0 1
150 0 1
0 230 2
0 200 2
I want to combine these two columns as one column. It would be something like that.
New_Column ...
That table contain:
chanelID,chanelclassify,createdate,movedate
and report has form:
index,date,chanelclassify,number of created chanels, number of moved chanels, avgTime
how should i do to count the number of created and moved chanel on one by one date and group by chanelclassify?
...
After going thru some tutorials on SQL SERVER 2008's new feature SPARSE COLUMN, I have found that it doesn't take any space if the column value is 0 or null but when there is a value, it takes 4 times the space a regular(non sparse) column holds.
If my understanding is correct, then why I will go for that at the time of database design?...
I'm using NHibernate with SQL Server 2005.
SQL rejects my Schema because I have an unquoted column name "User" which was auto generate from the property of my domain object.
<class name="Entity" table="Entities" lazy="false">
<id name="Id" />
<property name="User"/>
<property name="Domain"/>
<property name="Password"/...
I'm confused as to the effect of using AcceptChanges within a dataset. It appears from my tests that this forces the database changes to be comitted, disregarding any constraints on the database.
Can anyone confirm if this is the case, or if not, how this differs from using the Update function on the dataset?
...
I have a query that returns a result set similar to the one below
A | B | C | D
-----|----|----|-----
1 abc | d0 | e0 | true
2 def | d0 | e1 | true
3 ghi | d0 | e2 | true
4 jkl | d1 | e1 | true
5 mno | d2 | e2 | false
In Column A each value is unique. but column B,C,D have some duplicate values.
...
Hi,
I'm in the process of upgrading from SQL 2000 - SQL 2008
Would it be possible (or feasable) to set up log shipping from Server A - that has the sql 2000 database on, to Server B - that has the SQL 2008 instance on
Or is there a better way of upgrading?
I need to obviously test my application using the new SQL 2008 instance....
...
Hi,
I have a table of PricePlan that looks like
Table PricePlan
ID MerchantID NAME VALIDFROM VALIDUPTO
1. M1 Plan A 1-sep-09 30-sep-09
2. M1 Plan B 7-sep-09 21-sep-09
3. M2 Plan Da 1-sep-09 30-Sep-09
Given a @FromDate and @ToDate I need to find the matching id and Unique MerchantID....
I'm maintaining an application that uses SQL Server Express 2005 as the back end. The application allows users to create new databases and provide the name for the new database.
When the app is loading the default data I make the following SQL call:
DBCC CHECKIDENT('[myDB].[CsSchema].[CsMyDataType]', RESEED) WITH NO_INFOMSGS
The cod...
Hi
I have SQL Server 2008 with a table called ProductCategories designed like this:
Id | Name | ParentId
71 PCs NULL
32 MACs NULL
3 Keyboard 1
9 Mouse 1
5 Screen 1
11 Keyboard 2
7 Mouse 2
8 Screen 2
I would like to select from this table, and get a result set like t...
I ran into something a little odd this morning and thought I'd submit it for commentary.
Can someone explain why the following SQL query prints 'equal' when run against SQL 2008. The db compatibility level is set to 100.
if '' = ' '
print 'equal'
else
print 'not equal'
And this returns 0:
select (LEN(' '))
It appears to b...
In a misguided attempt at fixing a database permission issue, I changed the Log On account for my SQL Server from the default (Network Service) to a specific account. Now the server is stopped and when I try to restart I get:
"The request failed or the service did not respond in a timely fashion. Consult the event log or other applicab...
Hello, I have a case sensitive SERVER (SQL_Latin1_General_CP1_CS_AS) but the Database is Case insensitive (SQL_Latin1_General_CP1_CI_AS).
If I try to create the following stored procedure on the database, I get the error "Must declare the scalar variable "@test"."
CREATE PROCEDURE [dbo].[sp_Test] (@TEST int) as
begin
SELECT @tes...
Is it possible to specify a condition in Count()? I would like to count only the rows that have for example "Manager" value in Position column.
Edit: please read carefully, I want to do it IN count statement, not using WHERE; I'm asking about it because I need to count both Managers and Other in the same select (something like Count(Pos...
My question is concerning SQL connection status, load, etc. based on the following code:
public IEnumberable<MyType> GetMyTypeObjects()
{
string cmdTxt = "select * from MyObjectTable";
using(SqlConnection conn = new SqlConnection(connString))
{
using(SqlCommand cmd = new SqlCommand(cmdTxt, conn))
{
conn.Open();
...