all groups > sql server programming > july 2004 > threads for friday july 30
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
Need to concatenate all rows data in a single row
Posted by puneet.bansal NO[at]SPAM wipro.com at 7/30/2004 11:10:54 PM
Hi all,
I have an urgent requirement. I have a table which looks like
ID1 ID2 Value
1 1 a
1 2 b
2 1 c
2 2 d
2 3 e
where ID1 and ID2 is the composite primary key.
I want this to appear as
ID1 ID2 Value
1 1 a,b
2 1 c,d,e
Is it possib... more >>
Create empty table from existing view
Posted by Justin at 7/30/2004 10:29:05 PM
Is it possible to create a empty table from SQL view...like shown below?
CREATE TABLE tmpTable AS SELECT * FROM MyView WHERE 1=2
TIA
J Justin
... more >>
missing value of a field
Posted by mtgoli at 7/30/2004 10:29:01 PM
Hi
I have a problem with getting a field value.I have a view like this:
CREATE VIEW V1
AS
SELECT F1 AS Date,...
UNION
SELECT F2 AS Date,...
and I write a SELECT statement on it.I have at least a record in first select and F1 have value.but in my application using ADODataset I can see my r... more >>
Newbie Normalization Question
Posted by Bob McCormick at 7/30/2004 9:51:03 PM
I'm trying to better understand the structuring of data in databases and have considered a scenario that is befuddling me and so would appreciate anyones' thoughts on this as I'm trying to better understand database architectures.
If I have the following tables:
CREATE TABLE Games
(RecID INTE... more >>
trigger changing other table
Posted by Artur Z. at 7/30/2004 8:26:32 PM
hello
I'm here for the first time so hello everybody :)
I came here to ask one question, because I have a problem with mssql trigger
creation:
is it possible to create trigger on table A which modifies some records in
table B ?
I got the following error:
"The column prefix 'deleted' doe... more >>
There seems to be a memory leak in srv_paraminfo
Posted by Daniel at 7/30/2004 7:24:03 PM
I called my own extended stored procedure 1000 times to make sure there was
no memory leak but the sqlservr.exe memory usage went up so i thought there
might be a memory leak. I commented out all the code in the extended stored
procedure but the call to srv_paraminfo and it seems that srv_paramin... more >>
hiding sql from sql profiler
Posted by tonman at 7/30/2004 7:13:01 PM
i would like to prevent my customers from viewing sql statements/stored procs that i create for their use (for example using sql profiler). i basically want to protect my source from reuse.
is there a way to prevent the output of the sql being issued to the server?
thanks,
t... more >>
Inner Joins _ Joining 1 table to two others, conditionally
Posted by raj at 7/30/2004 6:19:01 PM
I am attempting to do this:
For each closed Transaction in Transactions (t) table, if CustomerID <> "" then JOIN to customer table (c) on t.CustomerID = c.CustomerID, if t.AccountID <> "" then JOIN to account table (a) on t.AccountID = a.AccountID.
Here is my "best" attempt...
SELECT * FROM Tr... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
how to enable the identity property on a column
Posted by PEACEMAKER at 7/30/2004 6:13:43 PM
anyone know how to enable identity property for an existing column using
SQL statement? ALTER TABLE ... only supports it with new columns, yet in
enterprise manager it allows you to enable it
... more >>
Query Help Needed
Posted by Ben at 7/30/2004 4:22:24 PM
I have about a year and a half of SQL Admin experience. I write some
T-SQL but I cannot figure out how to write a query to pull out the data
I need from our database.
This is the situation...
select * from table_name (NOLOCK)
WHERE
field_1 = '12345' and field_2 = '11'
Field_1 is ... more >>
Storing tree structures
Posted by j-m-autry NO[at]SPAM austin.rr.com at 7/30/2004 4:01:56 PM
What is the best way to store a tree structure in DB form.
Thanks... more >>
[Q]How can I get identity value from table which has only one column set identity?
Posted by ÀÌ»ó¼ö at 7/30/2004 3:42:06 PM
hi!
I have big problem with getting identity value for unique sequence.
I need unique integer value for key generation.
( key's format is YYYYMMDD + Random Alphbet + seqno )
I want to get unique sequence like oracle's sequence.
So, I created one table which has one int column, then
set ... more >>
Can I got the list of all the table in one database by sql script
Posted by Kevin Guo at 7/30/2004 3:15:06 PM
Dears,
I've got a problem. It is required to get the list of all the tables in one
database. Is there any sql script can realize it? Your answer will be highly
appreciated.
Kevin G
... more >>
timeout
Posted by G. Dean Blake at 7/30/2004 2:54:35 PM
I have a delete statement that when ran from Query Analyzer takes about 45
minutes to complete. When I put that statement into a dataAdapter and
execute with an ExecuteNonQuery, it gets a timeout after a few seconds. How
can I keep this long running process from getting a timeout?
Thanks,
G
... more >>
Script to find overlapping dates
Posted by Sydney Lotterby at 7/30/2004 2:29:18 PM
(SQL2K)
In the table and data below, I need to find those rows which have the same
IT value but have conflicting date ranges.
e.g. In the two rows below, both have value of 'AJ' for IT but part of the
date range for 'Official Public' 'AJ' falls within the date range for the
'Abstract of Judgme... more >>
error message in debugger
Posted by mike w. at 7/30/2004 2:21:02 PM
every time I run a sp in the debug mode it returns an error message
ODBC: Msg 0, Level 19, State 1
[Microsoft][ODBC SQL Server Driver][SQL Server]SqlDumpExceptionHandler: Process 68 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
what's up ... more >>
null value storing
Posted by hg at 7/30/2004 1:43:15 PM
Hi!
How does SQL Server 2000 store null values for
int, char(10), varchar(10), float, datetime, text,... etc.?
With an extra bit or byte or ...?
... more >>
Top 5 values (vertical ) for each column (horizontal)
Posted by tses NO[at]SPAM hotmail.com at 7/30/2004 1:38:44 PM
Hi all,
I have an Inventory table with the usual fields :
ItemID, Description, UOM etc.
I also have a BillsDetail table where I store all the item purchases,
with
fields like: ItemID, VendorID, DatePurchased, Qty, UOM, LastCost eta.
What I'm trying to do is create views with these fields:
... more >>
Recovery model and log file shrinking
Posted by Amin Sobati at 7/30/2004 1:34:51 PM
Hi,
I have database with recovery model set to Full. I executed this insert
command to increase the size of my log file:
insert MyTable(MyCol) select customerid from customers cross join [order
details]
The log file became almost 100mb. I did not make any backup from my DB and
when I issued ... more >>
How can change plan when execute Stored Procedure?
Posted by James Jarupan at 7/30/2004 12:59:01 PM
Hi All
I use sp_help_fulltext_columns in 2 databases at the
same server but it produce totally 2 different plan. I
beleive one plan is correct. How can I change it? It still
the same plan everytimes I run in specific database.
Thanks you in advance.
James Jarupan ... more >>
Conversion of binary to true or false
Posted by SL at 7/30/2004 12:51:21 PM
I've got a column that in my table that is of the binary datatype and
contains 0 and 1. I need to display that on a asp.net page as True or
False. Any ideas as to how I can do that, or where (sql, asp.net ).
Thanks
P
... more >>
Simple Update question
Posted by Chris at 7/30/2004 12:49:05 PM
I'm trying to UPDATE one table by using values in another table. They both have a common field. Does anybody know the structure of that? I've looked online.
Doing this is the SQL Query Analyzer:
SOmethign like:
UPDATE COMPANY_INFO SET COMPANY_INFO.COMPANY_SBTOTSYS = USERS_OLDDATA.TOTALSYSTEMS W... more >>
Database Design...
Posted by Bobby at 7/30/2004 12:47:31 PM
Hi all..
Actually my question is about database design, but I dont know the suitable
newsgroup for this question, so I post in here.
I have 3 type of status, that is 'new', 'pending', and 'close'. I can put
this seperately in 3 table or one table. I want to know your opinion about
this, sho... more >>
Using ID numbers in a database to relate to a different table
Posted by Drew at 7/30/2004 12:40:46 PM
Hey folks, I hope you can help. I have a table like below,
Dept
ID int incrementing
DeptName varchar
Then I have the following table,
Position
PosID int
DeptID int (from Dept table)
PosTitle varchar
My boss thinks that the Position table should have the actually Dept ... more >>
Mistake in BOL?
Posted by Amin Sobati at 7/30/2004 12:30:10 PM
Hi,
I read this paragraph in BOL about SHRINKDATABASE command:
----
When using data files, DBCC SHRINKDATABASE has the NOTRUNCATE and
TRUNCATEONLY options. Both options are ignored if specified for log files
----
As far as I know, we cannot issue SHRINKDATABASE for data file or log file,
but... more >>
DELETE is slow
Posted by G. Dean Blake at 7/30/2004 12:15:32 PM
I have a table with 1/2 million rows and I am deleting about 100,000 rows
and it is running around 45 minutes.
its a delete from - in...
delete from mytable
where mykey in
(select mykey from mytable
where mykey = mycriteria)
I did the same thing in a loop in vb.net using a dataadapter a... more >>
SQL query max(physical_io)
Posted by Don at 7/30/2004 12:05:27 PM
I have a job that runs every 5 minutes that executes the
SQL statement listed below.
How would I create SQL statement to find the maximum
Total_physical_io for each 5 minute interval?
Thank You,
Don
INSERT INTO KPC_Sysprocesses (EventTime, spid,
Total_physical_io)
se... more >>
Returning data from a tablename stored in another table...
Posted by Shawn Trevellick at 7/30/2004 11:59:14 AM
Weird I know but I could use some help...
Here is my problem. I have a table with table names in it like this:
TableNames:
Key | TableName
1 | Table1
2 | Table2
3 | Table3
In each table it has something like this:
Table1:
Key | Date
1 | 1/1/... more >>
database views
Posted by Just D. at 7/30/2004 11:44:25 AM
Hi All,
Who knows how the database views work at the lowest level? If we have a view
with a very long query and retrieve data from this view does it retrieve
data from all tables only when we send a query to this view, or always when
the relative data is updated this view should be updated by ... more >>
OT?: Application Architecture Question
Posted by CJM at 7/30/2004 11:29:47 AM
I have a potential client who has a Access-based DB which they use for
recording orders, customer details etc...
They want to provide some of this information online, eg. customer account
details and stock-levels etc, whilst retaining their existing functionality.
They also want to retain the ... more >>
Changing the way a query returns its results
Posted by John Mas at 7/30/2004 11:23:35 AM
I have query that returns some results including some with certain key
columns that have null values.
I want to have the results returned in alphanumeric order but with the null
values at the end. BOL suggests this can be achieve with the collation
property DBPROP_NULLCOLLATION value DBPROPVA... more >>
If Else statement
Posted by nsj at 7/30/2004 11:05:20 AM
I have a table called "UI". I need to update the 'ageGroup' field
automatically according to the following logic.
IF {@uiAge >= 0} && {@uiAge <=5}
SET @uiAgeGroup = 1
ELSE IF {@uiAge >= 6} && {@uiAge <= 11}
SET @uiAgeGroup = 2
ELSE IF {@uiAge >= 12} && {@uiAge <= 17}
SET @uiAgeGroup = 3... more >>
SQL Server 2005
Posted by Tim at 7/30/2004 10:35:33 AM
Hi,
I just read this:
"SQL Server 2005 doesn't let you specify a subquery as an argument to the IN
predicate"
in an article by Itzik Ben-Gan:
http://www.winnetmag.com/SQLServer/Article/ArticleID/43140/43140.html
Have I taken this too literally by applying a general context? Needless... more >>
Remove attachment from incoming mail
Posted by rmathuln NO[at]SPAM pacbell.net at 7/30/2004 10:27:06 AM
Anyone know how one can read thought an Exchange mail folder and
remove the attachments using T-SQL?... more >>
Diagrams Problem
Posted by Pupo at 7/30/2004 9:40:14 AM
HI
i have installed VisualStudio Sp6 after this installation when open my Sql
2000 server Sp3 i can't visualize Diagrams. Any operation on this windows
don't work.
I reinstalled Sql Sp3 but don't work.
Can help me?
Tia Pupo
... more >>
Xp_sendmail output to Excel File
Posted by Tanweer at 7/30/2004 9:36:54 AM
Please Help :)
How I can send a query output through xp_sendmail but send
it as an Excel file instead of csv file.
Thanks
Tanweer
... more >>
MSSQL vs. SYBASE
Posted by Lewis Howell at 7/30/2004 9:36:37 AM
Hello,
I am converting to MSSQL SERVER from SYBASE. In our client side application
we use callback procedures with CT_LIB to get information back from the
server during a lengthy process or an infinite (looping) process controlled
by or called within a stored procedure. I can not find any ty... more >>
Upgrade
Posted by SKG at 7/30/2004 9:32:35 AM
How can i upgrade sql70 database to sql2k database.?
Thanks!!!
... more >>
delete datafile problem
Posted by Mark Siffer at 7/30/2004 9:18:59 AM
I have two filegroups and one data file belonging to each filegroup. I am
trying to delete the datafile and filegroup that has not been assigned to
default. I have called dbcc shrinkfile on the file in the non-default
filegroup but it is apparently leaving one extent of data so I can't delete
... more >>
Making a certain string Lowercase
Posted by Drew at 7/30/2004 9:18:13 AM
I need to make the EmpID column in my table lowercase instead of uppercase.
The EmpID looks like the following, pl381234, which is the first initial of
the first name, first initial of last name, 38 (for facility code) and then
the last 4 digits of the social security number. Currently EmpID loo... more >>
Finding records that are missing
Posted by Drew at 7/30/2004 9:12:10 AM
I am trying to move some data around, and now that I have it moved, I want
to find out which records aren't there that should be. I have 2 tables,
Employees and EmpPersonalInfo (they are in different databases), If I use
these queries,
SELECT COUNT(*) AS TotalEmpRecords
FROM Employee;
SEL... more >>
Help Needed to build Query
Posted by Peter Newman at 7/30/2004 8:53:01 AM
CODE
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BacsHdrYearly]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[BacsHdrYearly]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BacsTrnYear]') and OBJECTPROPERTY(id, N'IsUserTab... more >>
Any tips - string or binary data will be truncated
Posted by Beema at 7/30/2004 8:26:10 AM
Has anyone got any handy tips on tracking down which column is the offender
when getting the error message "string or binary data will be truncated" ??
... more >>
Help with tricky select statement.
Posted by Lam at 7/30/2004 8:25:13 AM
Hi all,
I need to compare 2 days and pick the lasted date between
2 columns. Any help would greatly appreciate.
Please look at the result want below. Thanks again.
DROP TABLE #Test
GO
create table #Test
(
Policy_id INT NULL,
Policy_nb CHAR(15) NULL,
TranProces... more >>
Sample app does not work
Posted by vhoang NO[at]SPAM dpwt.com at 7/30/2004 8:23:03 AM
Any one who can help.
In the SQL sample apps, in the ADO/XML there is a ASP file
located at C:\Program Files\Microsoft SQL Server\80
\Tools\Devtools\Samples\ADO\XML\OpenXML.asp.
After modifying the server name and run it, there is error
at line 67 (adoCmd.Parameters)
The other FORXML.asp w... more >>
column-level optimistic concurrency using a history table
Posted by Chris Martin at 7/30/2004 8:21:03 AM
I'm trying to implement column-level optimistic concurrency where one user can update one column of a row and another user can update another column or the same row without a violation but if 2 users attempt to update the same column a concurrency violation occurs. The trick is that I don't want to... more >>
days in month
Posted by Derek Ruesch at 7/30/2004 7:53:01 AM
Is there a way to retrieve the number of days in a given
month?
Thanks for the help!
Derek Ruesch... more >>
Modify Column to identity
Posted by jez123456 at 7/30/2004 6:05:01 AM
Hi
I need to transfer data from an old sql server table to a new one with extra fields. The old table has a identity field (intAbsID) with seed and increment 1. I need to preserve this value in the new table.
The new intAbsID needs also to be an identity as above but in order to transfer the ... more >>
List DTSes
Posted by Patty O'Dors at 7/30/2004 5:43:02 AM
How do I list the DTSes on a server?
I know I could give myself access to msdb..sysdtspackages but I obviously don't need to do that as how does enterprise manager know what DTSes there are?
I want to present a list of DTSes (and preferably the user they're saved under) to the user in my custo... more >>
Access linked servers
Posted by Jiri Svoboda at 7/30/2004 4:54:22 AM
We have central sql server and a few linked sql servers.How I can
detect,if linked server is on line,then not exists problem with LAN,
from stored proc?If I can connect to off line server,sql server raise
exception, but I don't want it.
*** Sent via Developersdex http://www.developersdex.com... more >>
PDF does not export all data ...
Posted by Jochen Neyens at 7/30/2004 4:41:02 AM
I've a report on a single DB tabel containing 2 grouping levels. The report contains 2 table elements: one for summary info and another for grouped detail info. When I render the report in report manager it look fine. The report contains 193 pages. I can easily browse through all the pages. Export t... more >>
COLUMNS_UPDATED()
Posted by x-rays at 7/30/2004 4:01:12 AM
Hello Experts
Can I use the COLUMNS_UPDATED() to check if any column of
a row has really changed by its prior value, how please?
Thanks in advance.... more >>
Formula syntax for calculated column - what is it?
Posted by grant.ord NO[at]SPAM nospam.nospam at 7/30/2004 3:59:02 AM
Sorry for such a basic question but I have just come accross a useful example for a formula for a calculated column that I wanted in my database:
(case when ([GndID] = 1) then 'Male' else 'Female' end)
Great!
The trouble is I don't recognise the language.
Where can I find a reference for the l... more >>
Weird isnull(constant-column) problem
Posted by guillermo.gross NO[at]SPAM atosorigin.com at 7/30/2004 1:57:53 AM
Hi,
First question to the forum. Hope this works... ;)
I'm having different query results in two (supposedly identical)
execution enviroments. The problem is equivalent to the one described
below (for C&P purposes):
The schema:
-----------
CREATE TABLE [dbo].[A] (
[A_PK_KEY] [numeric](18, ... more >>
Help needed to write a SQL query
Posted by Justin at 7/30/2004 1:23:15 AM
I have three tables t1, t2, t3
Table t1 has primary key. T2, T3 don't have any primary key. All three
tables have one common column, which is the PK column of table1. Moreover
table2 and table3 are child tables of Table1.
Sample Data
==========
Table1
---------
PK_Col1 Col2
1 ... more >>
How can I retrieve data from the table in the variables?
Posted by Peter at 7/30/2004 1:07:06 AM
For Example:
declare @mytable char(10)
Use MyDB_A
set @mytable = 'MyDB_B.dbo.MyTab'
/* I want something implement the function like this */
if exists EXEC( 'select * from ' + @mytable) print 'OK" -- It's wrong, I
know
Thanks,
Peter
... more >>
|