all groups > sql server programming > december 2005 > threads for friday december 16
Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
How can I create a unique constraint on 2 columns where one of them allows nulls?
Posted by Keith G Hicks at 12/16/2005 10:07:39 PM
I have table as follows:
CREATE TABLE [dbo].[Table1] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[ValType] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[MainVal] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[CodeVal] [varchar] (5) COLLATE SQL_Latin1_General... more >>
Date of records
Posted by eagle at 12/16/2005 6:17:49 PM
Is there a way to tell when a record has been added to a table? And by
whom? I have data in a database that is obviously new, as the records do
not exist in any of our backups, but the user has dated them with old dates.
I am sure someone is entering these records in erroneously, but I canno... more >>
SELECT DISTINCT
Posted by TicToc at 12/16/2005 5:47:22 PM
What could cause a SELECT DISTINCT to still show multipule items of
the same item in dropdown lists?
I use alot of CASE and DATEADD functions but I do not see anything
worng.
SELECT DISTINCT CATEGORY, DATEADD(m, - 6, DISCONTINUEDDATE) AS SUNSET,
DATEPART(YEAR, DISCONTINUEDDATE) AS Year, ... more >>
Need advice on database planning. Thank You.
Posted by Miguel Dias Moura at 12/16/2005 5:09:26 PM
Hello,
I am working on a web site which will use SQL 2005.
I am planing my first SQL database and I am looking for advice.
1. There will be two types of users: students and professors.
2. Both users types will have login information.
(Username, Password, AccessLevel)
3. The remaining in... more >>
Reacting to DB events
Posted by Laurence Breeze at 12/16/2005 4:27:40 PM
I'd like to build an application that will react to specific changes to
data in a set of tables in a database. The application would replicate
these data changes to another database. The target database won't be
SQLServer. Neither is this simple replication, at times the application
will ... more >>
Determining financial year quarter
Posted by Bob at 12/16/2005 4:25:21 PM
The quarter function returns 1 to 4 but is based by default on a year
starting jan1 and ending dec 31 as far as I can tell.
I need to find a way to determine in what quarter of a year a date is when a
year starts and ends on other dates (eg May 1 and ends April 30) as is the
case in financi... more >>
find all sps where a field is used
Posted by Vikram at 12/16/2005 3:49:31 PM
In my database i want list of all stored procedures where i have used a
specific field.
Is there any way to do this.. any system sp which does this
... more >>
Dynamic pivot of resultset
Posted by Soren S. Jorgensen at 12/16/2005 3:11:46 PM
Hi,
I need to pivot and sum a resultset (based on a particular column) but I
don't know how many cols the pivot would result in.
Say you got resultset:
[C0] [C1] [C2]
1 100 OO
1 200 KK
2 245 OO
2 244 OO
3 188 KK
4 124 A... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Comparing to Resultsets
Posted by RSH at 12/16/2005 2:08:25 PM
I have a situation where I have two tables, one in Access and one in SQL
Server. There are several hundred thousand rows and the tables should
contain the exact same number of rows. They may not though and the count
could be off by one row or a hundred rows. I need to be able to identify
... more >>
Problem with AddNew on SQL server in c++ 2003
Posted by roberta.coffman NO[at]SPAM emersonprocess.com at 12/16/2005 1:22:39 PM
Hello,
I created a very simple database with only one table (Records) and on
that table only one column (Category datatype nvarchar).
I am trying to use the AddNew ado example found on msnd but it always
inserts a null value instead of the value I am trying to insert.
All my HRESULTs say S_OK b... more >>
Displaying HTML within an Access Report
Posted by Dooza at 12/16/2005 1:19:17 PM
Is this possible? I have a column which has data with HTML formatting.
Is it possible to remove the tags within a Stored Procedure so that it
displays nicely in an Access Report?
This is my SP:
ALTER PROCEDURE dbo.sp_Phat_Beats
AS SELECT fldcat, flddescript, fldtracklisting, fldprice,... more >>
Trouble with a computed colume
Posted by Jim Abel at 12/16/2005 12:56:03 PM
I have a table that I use a DTS to insert a date and cont value each day. I
add a computed column called isweekday that gets a Y or N depending in the
date. I now want to add another computed column for the mean of the counts
over the past 30 days, one value for based on weekdays and another... more >>
session timeouts?
Posted by rmanchu NO[at]SPAM gmail.com at 12/16/2005 12:45:46 PM
hi
i'm new to sql server.
i'm finding that when a connection sql server is idle for sometime, it
gets disconnected ??? is there a session timeout for sql server
connections? what's the default value for this?
currently, i'm refreshing the connection every 100 seconds with a
meaningless... more >>
clustered Vs NonClustered indexes
Posted by jaylou at 12/16/2005 12:38:02 PM
I was looking for some info on the major differences between a clustered and
a non-clustered index, but I couldn't find anything in the MS knowledgebase.
Which is more efficient? I am creating reports on an audit table that has
approx 20,000,000 rows in it. I indexed 3 columns as non cluste... more >>
Performance Question
Posted by mvp at 12/16/2005 11:53:02 AM
Hello Everybody.
Not sure how sql server query optimizer works ?
if i have a query like following.
select * from table where field1 = 'A' or field2 = 'B' or field2 = 'C'
so how the above query will execute ? if field1 = 'A' is true, the other
part of the query field2 = 'B' or field3 =... more >>
log files
Posted by HP at 12/16/2005 11:48:01 AM
How do you open log files (LDF)?
Thanks!... more >>
case statements
Posted by HP at 12/16/2005 11:47:02 AM
Can you use case statements in a where clause? if so, how?
Thanks!... more >>
Compare feilds in seperate databases on seperate servers
Posted by Darren Savery at 12/16/2005 11:08:05 AM
Hi,
I want to run an update script where a field in a table in a database on a
server is equal to another field in a table in a database on a seperate
server. Here are the details:
Server 1:
Server name - Server1\Logi
Database - Ascent
Table - _customers
Field - email
Server 2:
Ser... more >>
==again== constraints with nulls
Posted by sqlster at 12/16/2005 10:35:02 AM
I posted this question yesterday with out good table structure and sample data
http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?query=sqlster&dg=microsoft.public.sqlserver.programming&cat=en-us-technet-sqlserv&lang=en&cr=US&pt=261BA873-F3AB-420E-96D6-E3004596A551... more >>
Ok, I give up...
Posted by kdd21 NO[at]SPAM hotmail.com at 12/16/2005 10:29:49 AM
Been working in Visual Studio 2005 and got to the point where
I needed to build a native program that interfaces with SQL Server
via the bulk copy API. So, I d/l'ed SQL Server 2005, installed it
and tried a simple example from MSDN from the bcp_bind
documentation.
Fails because it is unable ... more >>
Quicker Cursor or Table Variable
Posted by Ben at 12/16/2005 9:35:50 AM
Hi
I have a large update batch to make on our database which will run overnight
when no users are logged in.
I always use a Table Variable instead of a Cursor to conserve resources, but
in this case resources are not a problem but speed is.
Which would be quicker: cursor or table variable... more >>
Counting the number of fields that are populated in row
Posted by dmagoo22 at 12/16/2005 9:01:33 AM
I have 2 large tables that I'm selecting off of. part of my select is
to get the number of stores visited. The table that has this
information has the store names as columns. If a store wasn't visited
there will be a null value. I need to be able to count the number of
fields that don't have the... more >>
Help! Uninstall
Posted by Sandy at 12/16/2005 8:59:03 AM
Hello -
My OS is Windows 2000 Professional.
I downloaded files for MSDE and installed them. I was not able to get Sql
Server running. There was no uninstall exe and it did not show up in my
Add/Remove programs. I then tried installing Sql Server 2005 Express. It
did not run either. ... more >>
creating a function to be used in select query
Posted by Newbie at 12/16/2005 8:42:38 AM
I have this select query which returns a date. I would like to be able to
call this from a stored procedure and have the result appear in the result
set from the stored procedure.
i.e. SELECT *, CalcDate
FROM Table
WHERE somedate = @dte
The CalcDate field would be the c.dt in the follow... more >>
Will this two SQL statements get the same result?
Posted by Matthew at 12/16/2005 8:21:02 AM
delete from OrdersAudit
where OrderNbr not in (
select OrderNbr from Orders)
delete OrdersAudit
from OrdersAudit,Orders
where OrdersAudit.OrderNbr <> Orders.OrderNbr
How much do you think the performance difference will be? There's clustered
index on OrderNber for both tables.... more >>
Stored Procedure Cache Question
Posted by Anthony Sullivan at 12/16/2005 8:08:35 AM
Hey Folks,
I'm having a problem that confuses me. We use MSMQ to scale our database
calls. We have a .NET listener that grabs items out the queue and processes
them calling a stored proc. This process has backed up significantly lately
and we've been looking for a cause. Yesterday for an un... more >>
Trying to insert a LOT of records
Posted by David Jessee at 12/16/2005 8:07:02 AM
I have a table that has 3 fields..there's a clustered index on all 3
fields.....
The data in this table can change a lot depending on the changing state of
the system. For performance purposes, I can't have a bunch of triggers
throughout the system that fire every time the DB state changes... more >>
Update Stored Procedured question
Posted by dbuchanan at 12/16/2005 8:04:49 AM
Hello,
Can I put two updates withing an update strored procedure?
Is my syntax correct?
Why I want to do this:
My datatable is a union of two tables. It currently works well except
for the fact that I have to update the records of corresponding tables
separately.
All records that came f... more >>
Works in SQL 2000 but Fails in SQL 2005??
Posted by LineVoltageHalogen at 12/16/2005 7:24:30 AM
I would greatly appreciate any help that you can provide. I have the
following dml/query (part of a stored proc) that runs perfectly in SQL
2000. However, when I run it in SQL 2005 I get the following error:
"An aggregate may not appear in the set list of an UPDATE statement"
Here is the d... more >>
SQL Server 2005 and GO issue
Posted by JosephPruiett at 12/16/2005 7:19:02 AM
Ok gentelemen we have come accross a little issue using the 2005 platform
which is a very strange occurance. We can open a stored procedure that has
been saved and at the top of the SP we have the following:
USE DatabaseName
GO
Followed by if exist statment etc etc.
Well we get the fo... more >>
(Non) Updatable view problem
Posted by mfan at 12/16/2005 6:53:20 AM
Hi there!
I created this view:
select
pk,
name,
( select count(*)
from dbo.Orders ord
where ord.cust_fk = cust.pk
) as order_count
from dbo.Customer cust
When, being in the Design of the view in SQL Server Enterprise Manager,
running it, I can make changes to ... more >>
SELECT does not return all on left of join when right side has lim
Posted by richardb at 12/16/2005 6:48:02 AM
I have learned much about SELECT from helpful replies to my posts, but am
stumped on this one. First here is the DDL:
SELECT f.FinanceClass, COUNT(*) AS TotalCharges,
SUM(dbo.udfAgeAmount (0, 29, DATEDIFF(day, service_date, GETDATE()),
units*fee)) AS Amount00,
SUM(dbo.udfAgeAmount... more >>
Copy data for reports
Posted by jkane NO[at]SPAM satx.rr.com at 12/16/2005 5:45:11 AM
I need to copy a significant amount of data (1-2gb) during work hours
to another database for some lengthy numeric calculations and a report.
Phantom rows inserted during the copy operation would be a problem but
a serializable transaction would impact availability. I was
considering using BC... more >>
Does SQL uses index in the following select statement
Posted by Alex via SQLMonster.com at 12/16/2005 5:13:15 AM
I have the following table structure:
PK_Column1
PK_Column2
IndexedColumn
Column_ABC
Column_XYZ
Does SQL Server 2005 uses the IndexedColumn index to find the MIN and MAX
values in the following select statement:
SELECT MIN(IndexedColumn), MAX(IndexedColumn) FROM MyTable WHERE
PK_Colum... more >>
Changing the collation
Posted by Enric at 12/16/2005 4:31:02 AM
Dear gurus,
I am pursuing for a statement or function which allow me change the
collation at database level.
Thanks in advance and regards,
Enric... more >>
time problem
Posted by Jose G. de Jesus Jr MCP, MCDBA at 12/16/2005 4:21:02 AM
hi all,
i have a table with two fields
name, date_hired
a , 2004-04-16 10:02:31.000
B , 2004-04-18 20:02:31.000
i want a select statement that returns
a , 2004-04-16 00:00:00
B , 2004-04-18 00:00:00
--
thanks,
------------------------------------
Jose de Jesus Jr. ... more >>
Error executing User Defined function on another server
Posted by Suhas Vengilat at 12/16/2005 2:36:03 AM
Hi All,
Facing a problem while executing a user defined function (UDF) which resides
on another sql server ( we have access on this sql server to execute the
UDF). This UDF accepts a varchar parameter with max length 8. When we
execute the function as
Select * from
SERVERNAME.DBName.db... more >>
OpenQuery using parameters
Posted by (myob NO[at]SPAM beatles.com) at 12/16/2005 1:18:40 AM
I need a little help with using parameter values in the where clause
with the OpenQuery statement.
What would the syntax for the following be if 10 was a variable? And
does the syntax change depending on the datasource? In my case I am
querying an Oracle database. But I can't get it work on a... more >>
best way to log out when running the job
Posted by Ed at 12/16/2005 12:55:04 AM
Hi,
When I run the job, I am not sure whether it could be done at the table
level to log users out. I would not want to keep them out of the whole
database...only the tables I are updating. Also, once the job is running, I
would like to prevent any users from accessing the tables I am upd... more >>
Log shipping question
Posted by Bas Groeneveld at 12/16/2005 12:03:59 AM
Hi
This is my first post in this newsgroup and I am not sure if I have chosen
the correct group. Please advise if a more appropriate group exists.
I am planning to set up replication to a standby sql server using RYO log
shipping in an application where a move to a backup site may be require... more >>
|