all groups > sql server programming > april 2007 > threads for monday april 2
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
Pivot Comma List
Posted by David at 4/2/2007 9:42:04 PM
Hi All
I have a table that contains a comma separated list of products that I want
to pivot so that they each product is listed individually. Below is a sample
of the table and the data as well as how I am trying to return the data. Any
assistance anyone can provide would be appreciated.
... more >>
Grouping two UNIONed tables
Posted by Ant at 4/2/2007 9:08:04 PM
Hi,
I have two tables with a UNION ALL joining them. There are 3 columns. All
cols are the same name except one. The difference is they pull data from
differerent tables, though the Alias name is the same. How can I group this?
e.g.
Select a.col1 AS [Col1],
a.col2 AS [Co... more >>
Query to select entries which contain all elements of a subset
Posted by bborowin NO[at]SPAM gmail.com at 4/2/2007 8:56:18 PM
Hi there,
I'm having trouble coming up with a query for the following scenario:
I have a database of movies, and actors that have played in these
movies. I would like to find movies which have two actors in common.
The [actors] table contains actorId and name; the [cast] table
contains acto... more >>
Exporting SQL Server Objects (not just tables) in SQL Server 2005
Posted by Mike at 4/2/2007 8:50:01 PM
Hi. I'm quite new to SQL Server 2005, so please forgive me if this quesiton
is sophomoric.
I need to export a table (including it's primary key, etc) and a stored
procedure from one database to another database. In SQL Server 2000 there
was an option to Export Objects and you could specif... more >>
error message
Posted by Mark Goldin at 4/2/2007 4:43:33 PM
Cannot connect to UFDCRDEV0005\SQLSERVER.
------------------------------
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error
occurred during the login process. (provider: Shared Memory Provider, error:
0 - No process is on the other end of ... more >>
sql server 2005
Posted by Ellie at 4/2/2007 4:04:55 PM
I have a VB6 application that runs fine under sql server 2000 if I open a
> connection on the server side and set the cursertype to adOpenKeyset. This
> does not work with 2005. I need to have the connection open on the server
> not the client and be able to movelast, movefirst, etc. Is there a
... more >>
SQL2005Express
Posted by Mark Goldin at 4/2/2007 4:01:27 PM
I have installed it on my computer. I have loaded some databases to it and
it seems to be working fine.
What I dont understand is why when I click on a SP or a function with a
right mouse button, I dont see properties choice in the popup menu.
Can someone help, please?
Thanks
... more >>
.ldf file is out of control.
Posted by Bob McClellan at 4/2/2007 3:16:35 PM
I have one database where the .ldf is growing out of control
I am approaching 40gb and the .mdf is approx 5gb.
I've backed up both files but the .ldf size is not decreasing.
Can anyone help?
thanks in advance,
bob.... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
query question
Posted by Mark Goldin at 4/2/2007 3:14:15 PM
Here is a sample data:
ID JOB_ID OLD NEW UPDATETIME
15621 9726 3 4 2007-03-28 10:24:24.610
15620 9726 4 3 2007-03-28 10:18:33.900
15613 9726 3 4 2007-03-28 08:39:19.410
15587 ... more >>
loop / top record based on order
Posted by sbcaco at 4/2/2007 3:14:08 PM
hi there,
I am trying to get one record from a table based on three fields sort order:
select prodname, CostB, CostC, CostD, E
from Costs
order by CostB, CostC, CostD desc
Costs has 5000+ records.
I only want 100 rows returned for each of the unique prodnames in a 2nd
table based... more >>
Drop table on another server
Posted by Bob McClellan at 4/2/2007 3:10:43 PM
This works fine:
Select *
From Server2.Db2.dbo.ContractIndexUnique
If I try
DROP TABLE Server2.Db2.dbo.ContractIndexUnique
This bombs with:
Msg 117, Level 15, State 1, Line 1
The object name 'Server2.Db2.dbo.' contains more than the maximum number of
prefixe... more >>
populate second combobox based on the first combobox choice
Posted by yshie via SQLMonster.com at 4/2/2007 3:10:38 PM
i want to update my second combo box based on the choice on the first
combobox. what is the simplest way to do this? i had my first combobox works.
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200704/1
... more >>
How to exclude quickly?
Posted by hairbo at 4/2/2007 3:07:31 PM
Apologies if this is answered elsewhere...
I've got a SQL query where I want to say roughly this:
SELECT count(user_id) FROM user
WHERE user_id IN
(
SELECT user_id FROM firsttable WHERE [wherecondition]
)
AND user_id NOT IN
(
SELECT user_id FROm secondtable WHERE [wherecondition]
)
... more >>
Articles on Natural vs Artificial Primary Keys
Posted by bbcrock NO[at]SPAM gmail.com at 4/2/2007 12:51:25 PM
I am on a project with other contractors using one SQL Server Express
database that will be distributed to users.
The Artificial vs Natural Key argument has reared its ugly head. Can
anyone point me to any articles online that comes at the issue from
the most even-handed and academic perspect... more >>
searching for a range a values
Posted by PamelaFoxcroft at 4/2/2007 12:05:29 PM
Hi
I have to search for a range of values. For example I have to search
where a value of a column is a; another time I might have to search
for a or b; another time for a or c; another time for b or c; and then
another time for a or b or c.
What is the best way to do this? I am thinking of ... more >>
Drop records from a table without log entry
Posted by Datasort at 4/2/2007 11:26:04 AM
Is there a way to remove large amounts of records from a table without
entries to a log file? I can't use truncate.
Thanks in advance
... more >>
create a sp from query output
Posted by darrin.wilkinson NO[at]SPAM cma.ca at 4/2/2007 10:54:03 AM
Hi,
Is there a way in either SQL server 2000/2005 that would allow me to
create a stored proc from the output of a query?
Eg.
To demonstrate my question lets say I have a script to create a table
and populate the table with sequential numbers from 1 to 100000:
PRINT "Create Procedure u... more >>
a newbie T-SQL question
Posted by Johndow at 4/2/2007 10:52:47 AM
There is a seemingly easy T-SQL I have trouble to write, could anyone help
me?
I can only use SQL2000, so if your solution uses new clauses in SQL2005, it
will not helpful for me.
My requirements are following:
1. The final select statement will return all columns,
2. returned records mu... more >>
Table Intersection Using One Column
Posted by Don Miller at 4/2/2007 10:37:59 AM
I need a query to run on 2 to N identically-specified tables that returns a
full set of columns from each table but that intersect around just one of
the columns. And, I should be able to programmatically generate the complete
SQL query (no INTERSECT since I'm using 2000 and not 2005). For exa... more >>
Column alias based on a field
Posted by PabloSolera at 4/2/2007 10:01:39 AM
Hi everyone,
I don=B4t read this group very often, no databases on my typical work,
but this time I really need some help.
We have to get some data from a table, but (there=B4s always one) when
the table was designed, a terrible misunderstanding was made.
We needed a table with 5 fields, ... more >>
How can I determine what function(s) are using tempdb?
Posted by Michael Bray at 4/2/2007 9:58:08 AM
I have a server where I am the only user. My applications are the only
ones on this SQL server. Recently, the tempdb log file is growing
extremely quickly - I usually get to 10G within a week or so, forcing me to
clear it out on a daily basis.
The only thing that has changed is that I re-... more >>
Alter Statement cant complete
Posted by Lontae Jones at 4/2/2007 8:58:02 AM
I have a table that has 888,387 records and I am trying to alter the table to
add a column TX_THEFT_FEE money and it doesnt complete. I run a sp_who2 and
it displays -2 in the blkby column. Any ideas??
ALTER TABLE POLICY ADD TX_THEFT_FEE MONEY
go
TIA... more >>
Trouble restoring Database over another DB
Posted by Noncentz303 at 4/2/2007 7:58:03 AM
We just installed SQL 05 and we are trying to restore a new DB over an older
DB. We go through the usual process of restoring the DB when we get this
error....
Restore Failed for Server "name" (Microsoft.SqlServer.Smo)
Additional Information
System.Data.SqlClient.SqlError: Exclusive acc... more >>
string delimiters
Posted by delard at 4/2/2007 7:44:00 AM
Hi,
I'm migrating some SQL code from postgres to SQL Server. Under postgres
there was a handy syntax that allowed you to use $mytag$ as a string
delimiter - ie for cases where your string might contain occurances of single
quotes etc.
eg you could say WHERE thisstring = $mytag$ this stri... more >>
t-sql novice question
Posted by jonhrs NO[at]SPAM gmail.com at 4/2/2007 7:15:30 AM
Hi,
Could someone please assist with the construction of a T-SQL query?
I have data, of which an example is shown below:
Server CaseID User Date/Time
SERVERNAMEME 600-02-3104205 Joe Bloggs 2007-04-02 00:00:00.000
BG2782H-Y7 600-02-3104244 Mister Somebody 2007-04-02 00:00:00.000
UHQW... more >>
Read Write Access to MS SQL 2005 DB
Posted by Aaron at 4/2/2007 7:15:06 AM
Having trouble accessing a MS SQL 2005 DB I just created through an
ODBC connection. I'm able to create and view tables, but I'm unable
to write to them. Can anyone help me on how to set this up correctly?
Thanks in advance.
... more >>
How Managed Aggregate function works in SQL 2005
Posted by Deepson Thomas at 4/2/2007 6:18:02 AM
Hi,
When we create a aggregate function using c# in sql 2005 we need to use
the “SqlUserDefinedAggregate†attribute to the structure. Then we have to
create four methods
1) Init
2) Accumulate
3) Merge
4) Terminate
I like to know how these functions relates to each ot... more >>
perform database operations directly or not?
Posted by yshie via SQLMonster.com at 4/2/2007 5:48:27 AM
I've read a lot of articles over the net about executing SQL commands. but
which is better? to perform this database directly or not(using dataset)?
--
Message posted via http://www.sqlmonster.com
... more >>
DROP TABLE failed
Posted by Peter Hyssett at 4/2/2007 5:30:01 AM
Some time ago a Stored Procedure was run which should have dropped several
tables. All except one were dropped correctly, but in one case the tabe
disappeared but its entry in [sysobjects] did not. On other occasions the SP
has run correctly, except when it has another go at deleting the probl... more >>
SQL Server 2005: Errors in Stored Procedures
Posted by steve.chambers NO[at]SPAM gmail.com at 4/2/2007 4:25:16 AM
I am running a Stored Procedure in SQL Server 2005 to import a large
amount of data. In order to speed up the processing I would like to be
able to attempt to insert a record and if the INSERT fails then use an
UPDATE instead.
(This is much faster than checking for existence of the record since
... more >>
How to use PIVOT for dynamic transform rows to columns
Posted by anuragsji at 4/2/2007 3:43:54 AM
Hi,
I want to use PIVOT to transfer my rows data to columns(for example in
10 rows one columns is price which has prices of each month). The
result is showing 10 rows and column containing price.
I want to see price of 10 rows(for each month) in column manner means
for result should display r... more >>
Accessing data from a Select Openquery statement
Posted by stainless at 4/2/2007 1:33:55 AM
In MS SqlServer 2000, I have a DTS package that has a mainframe
connection via ODBC. Thus, in my "Execute SQL Task" statements, I am
connecting and selecting 2 columns from a view. ie.
SELECT * FROM OPENQUERY(DB2_DBI, 'SELECT CLIENT_LOCK, ENABLED FROM
CDST001.VSHADOW_AMN')
This will select... more >>
EXISTS queries in OSQL
Posted by Mark J. McGinty at 4/2/2007 1:24:00 AM
Greets,
Has anyone ever had any problems with conditional expressions using EXISTS,
that failed to evaluate correctly when executed under OSQL.EXE?
Example:
if EXISTS (select * from dbo.sysobjects
WHERE id = object_id(N'[dbo].[MyTbl_Trigger1]')
AND OBJECTPROPERTY(id, N'I... more >>
SQL2005 Express - Vista - Invalid object name '#spdbdesc'
Posted by ianforgroupuse NO[at]SPAM hotmail.co.uk at 4/2/2007 12:48:52 AM
I'm running Vista Business edition on 2005 Virtual PC.
Installed SQL Server 2005 Express latest download, with instance of
MSSQLSERVER and service accounts running under "NT AUTHORITY\SYSTEM".
Mixed mode authentication specified and sa password specified.
Used server manager to create user login... more >>
UPDATE locks
Posted by Chakravarthy at 4/2/2007 12:20:11 AM
I have a basic question.
Within a READ COMMITTED transaction, will an UPDATE statement lock the
table, or the row being updated ?
And what is the granularity of the lock if the transaction is READ
UNCOMMITTED ?
... more >>
"row guid column"
Posted by Smokey Grindle at 4/2/2007 12:00:00 AM
We are starting to use GUID's our or PK's now because of the massive amount
of data we are going to be storing... and for other reasons like tracking
down where its used quicker... we set the column as a uniqueidentifier, set
its default value to "newid()" and make it a primary key, but then I... more >>
stored procedure validation -
Posted by Tom at 4/2/2007 12:00:00 AM
Is there a way to pass in a username and password to a stored procedure and
have that store procedure validate the username and password against the
aspnet_membership tables?
here is the scenario. I have a handheld device, the user will pass a
username and password to a stored procedure, th... more >>
Drop Table Dynamically
Posted by Sugandh Jain at 4/2/2007 12:00:00 AM
Hi,
I want to do something like this..
declare @table varchar(50);
set @table = 'TableName'
DROP TABLE @table
But I get the error
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '@table'.
How to go about doing this? The variables in TableName are stored in anothe... more >>
SQL question
Posted by Sam Commar at 4/2/2007 12:00:00 AM
I need to update some field based on wheather Field Invtid begins with 1 to
9
and then update the others which do not begin with 1-9 . i.e all others
other then those that begin with 1 to 9.
I am using this query but this is only for Invtid beginign with 1.-
update inventory set invttype ... more >>
Help with t-sql statement
Posted by Harry Strybos at 4/2/2007 12:00:00 AM
Hi All
Can someone help me with the following t-sql statement:
SELECT A.ID,
A.BusinessName,
(Select Count(*) From dbo.Member
Where (Account_ID = A.ID)
And (Active = 1)) AS CurrentMembers,
(Select Max(CountCreditCard + CountDirectDebit) From dbo.Settlement
Where Account_ID = A.I... more >>
|