all groups > sql server programming > march 2005 > threads for tuesday march 29
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
SQL: A problematic exists query (again)
Posted by mawi at 3/29/2005 10:46:13 PM
Hello,
I've tinkered with this problem but have not found a solution.
(There is setup SQL below and my problem query)
*** Structure: Nodes transferring units. One nodes table.
It is related to itself, so that a nodes can supply another
node.
This relation (xfers) also has a volume, how m... more >>
trigger after insert
Posted by Jason at 3/29/2005 9:57:11 PM
Hi,
I'm having trouble with an after insert trigger. The trigger handles an
integrity check on a second id column.
I have a scheduled stored procedure which can return a recordset. If the id
in that recordset does not exist in the table with the trigger it may insert
the new id's. The pr... more >>
I need to find total for rows with a certain value: how?
Posted by someone at 3/29/2005 8:25:32 PM
I have a table that contains a column that collects discreet data (1 for on
and 0 for off, just those two values) and a date column which is a timestamp
containing a date and time. There are other columns in this table but they
are unimportant in this discussion.
A process inserts rows int... more >>
Query
Posted by LacOniC at 3/29/2005 7:53:56 PM
ColumnX holds values between 1001 and 5999. How can i make a query to get that result set:
Group Quantity
1000s xxx
2000s xxx
3000s xxx
4000s xxx
5000s xxx
... more >>
HELP(!): Possible corrupted DB
Posted by Vycka at 3/29/2005 6:46:24 PM
Hello,
The problem accured with the database that contains critical data, so it is
very important to me to solve it as quickly as possible.
So the problem is that I cannot attach my database to the SQL server.
How all this began? At first I decided to back up my database. But by
mistake in ... more >>
How can I see if a SQL database is modify
Posted by Cristian Moraru at 3/29/2005 6:40:48 PM
I want to save a marker of a database and periodically I want to check if
my database is modifying
... more >>
T-SQL question
Posted by Joe at 3/29/2005 6:37:24 PM
I have 2 tables: invoice and invoice item.
Invoice has column invoiceno;
Invoice Item has column invoiceno, itemno, price.
How can I retrieve records which are the 2 lowest item price for EACH invoice?
Thanks.... more >>
osql utility dependency
Posted by Zhu Bo at 3/29/2005 6:18:50 PM
Hi,
Does the command-line utility osql.exe has any external dependencies?
I'm building a java installer that needs to interact with MSSQL with
osql.exe. Now the temporary solution is to ensure the machine on which
the installer is run has either MSDE or MSSQL client installed, but that
is... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Restoring from Backup and Fulltext Catelog
Posted by Sathian at 3/29/2005 5:57:07 PM
Dear Friends,
When deploying the application I send a back up of the data base to be
restored on clients place.
there is a table in the database which a has FullText Index associated with
it. However since it is in a different machince the client server cannot
recognise the Full-Text catelog.... more >>
query on view
Posted by Jen at 3/29/2005 4:19:01 PM
Hi,
I have following tables, I need to query all transaction for accounts. So I
created a view "txn_account" to simple union both tables and if a table
doesn't have a field I made it NULL in the view:
accounts (account_id, address, lastName, firstName, email, zipcode....)
credit_account(accou... more >>
What would happen in this situation? Stop DELETE process
Posted by Star at 3/29/2005 4:18:26 PM
Let's suppose that I'm running a DELETE statement and in the
middle of it, there is a network problem, and the connection to the db is
lost.
Will the records be deleted partially?
For example. We have 100.000 records where MyField='test'
if I do: DELETE FROM Table where MyField='test'
and 3... more >>
Paging (SQL) without the datagrid in ASP.NET?
Posted by Phin at 3/29/2005 4:17:44 PM
Hi,
I am able to display data and "page it" using the data grid. I don't
want the overhead and I need to format the data in a easy way.
How can you do paging in ASP.NET (using VB) without the datagrid (so
the data is displayed in HTML tables with hyperlinks to the next "page"
of data and th... more >>
Collaion problem
Posted by simon at 3/29/2005 4:13:48 PM
I have tempTable with join to data table:
.....from #tempTable T1 LEFT JOIN cpoProdNivo n ON T1.izd_nivo=n.[ID]
I get an error:
Cannot resolve collation conflict for equal to operation.
Why?
They are both on the same server and table on the server has default
collation.
Should I de... more >>
table owner
Posted by Gav at 3/29/2005 4:06:38 PM
I have a database where all the tables are owned by user 'prd'. When I write
a query I have to pre-pend prd to the table name. ie. "SELECT * FROM
prd.test". Is there any way to allow me to write queries without having to
specify the owner.
thanks
Gav
... more >>
SQL query...
Posted by Beau at 3/29/2005 4:01:27 PM
I've got this query I need to write dynamically in ASP.
This is not correct, this is just what I have.
=============================
select distinct hd_sku as SKU,
hd_desc as SKUdesc,
sum(hd_trn_qty) as SKUqty
FROM rainvhdt
GROUP BY hd_sku,hd_desc,hd_invoice
HAV... more >>
foreign keys and relationships
Posted by param NO[at]SPAM community.nospam at 3/29/2005 3:47:16 PM
Hi all, is it possible to have foreign keys and indexes that reference
tables in another database on the same server in SQL 2000? We are working on
designing an application and was thinking about setting up different
databases for logical segments of the application.
TIA!
... more >>
xp_cmdshell
Posted by Ed at 3/29/2005 3:37:04 PM
Hi,
I know the xp_cmdshell is default to sysadmin role to run. WHen i read
the BOL, it said it can be configured to be run by any users after granting
the permissions. but it did not mention how....
can anyone explain to me how since i have a xp_cmdshell stored procedure
needs to be r... more >>
help needed with sp_executesql
Posted by Nitin at 3/29/2005 3:25:49 PM
Hello,
I wish to execute a simple dynamic sql script using sp_executesql, in which
I am trying to input the name of the database dynamically.
Here is the script -
------------------
DECLARE @databaseName NVARCHAR(100)
set @databaseName='testdb'
DECLARE @strSQL NVARCHAR(400)
SET @strSQL ... more >>
returning 1/1/1900
Posted by Kenny M. at 3/29/2005 3:23:03 PM
Hi
I have a query like this
SELECT DateHour FROM Tickets
The field DateHour is a DateTime.. when this field is NULL I want to return
in my select an empty string (" ")
I have tried using ISNULL and COALESCE but the select always returns
1/1/1900
What should I use?
thkns for ... more >>
Timeout problem...
Posted by Páll Ólafsson at 3/29/2005 3:18:57 PM
Hi
Im currently developing a large WinForm application that is coded with C#
..Net. There are app. 500 users using this application and most of them are
always running the same procedure. They keep getting timout error when I
run ExecuteReader?
I have checked out all the indexes but my p... more >>
SQL course for Access programmers
Posted by Jonathan Blitz at 3/29/2005 2:47:15 PM
We have a number of employees who have experience using Access.
We are now converting to ADPs and need the programmers to learn SQL.
Does anyone know where we can find courses within the NY City area?
Jonathan Blitz
CNCG Limited
NY
NY
... more >>
Estimated row count vs. actual row count
Posted by Igor Marchenko at 3/29/2005 2:42:57 PM
Hello!
I was trying to troubleshoot a query. Very last step show estimated
rowcount=142386. When query is executed, it returns only 7234 rows. I
executed UPDATE STATISTICS ... WITH FULLSCAN against all tables involved in
this query but this didn't make a difference. I am not sure what else ... more >>
manipulating binary data
Posted by Gloria at 3/29/2005 2:39:01 PM
To all,
I have a binary data type in my database. It is an array of doubles. I
would like to create a DTS package that can change this binary data type into
an array so I can retrieve one of the double values at a specific index.
Is there any way to do this?
How can I cast the binary da... more >>
Data in one column contains column name of other table
Posted by Malkesh Sheth via SQLMonster.com at 3/29/2005 2:29:35 PM
I have one table in one of its column it stored column name of another
table. i want select statement to select that column name. i will explain
this with example
Table1 has columns with name ID,col1 and having data in that column as
(1,tb_col1),(2,tb_col2),(3,tb_col3) etc
and another table has... more >>
set AD password from a SQL proc?
Posted by Al Blake at 3/29/2005 2:28:18 PM
Can anyone come up with a way to set an AD password from within a SQL stored
proc?
Why?
a) we create AD accounts for young kids (age 5 up)
b) We use a SQL stored proc to give them easy to remember passwords
c) We store these passwords in our SQL database - cos they are young kids
and they ... more >>
SP_EXECUTE SQL procedure
Posted by simon at 3/29/2005 2:25:28 PM
I'm using sp_execute SQL procedure:
SET @sql=3D'SELECT .....'
SELECT @paramlist =3D '@xdatZ datetime,@xdatK datetime,@xkorak =
int,@xmediji nVarchar(4000),@xTipM nVarchar(4000),@xVir nvarchar(4000)'
EXEC sp_executesql @sql, =
@paramlist,@datumZ,@datumK,@korak,@mediji,@tipMedija,@vir
The ... more >>
Drop Table permissions...
Posted by Lost! at 3/29/2005 2:15:03 PM
I'm thinking this can't be done, but wanted to try it anyways...
Is there any way a user can grant permission for another user to drop one of
his/her tables? Something like this:
GRANT DROP TABLE ON MYTABLE TO ALL;
We have a table which can be created by a user then left alone for a while... more >>
**Create Login **
Posted by maryam rezvani at 3/29/2005 1:30:40 PM
Hi
I want to create a new login "L1" in SQL 2000 and let him to be as L1's
owner and can backup and restore it too,I selected the "public" and
"db_owner" in Enterprise manager as I defined the login name ,but what
should I choose to let him to do "backup & restore db" too?
Any help wolud be ... more >>
Restore MSDB
Posted by A. Robinson at 3/29/2005 1:29:05 PM
A quick question on MSDB and database backups:
We're moving one database to another. This database has a ton of jobs
associated with it. W're going ot be moving this database to a fresh install
of SQL Server.
My question is: if I wanted to maintain the jobs that I've created, would
just ... more >>
DTS package
Posted by bagman3rd at 3/29/2005 12:59:04 PM
I have a DTS package which imports data from an Excel spreadsheet into an SQL
Server database. The package works fine, but I would like to take the
package to the next step in automation. How could I call the package(from VB
..Net or QA) to be executed with only one change in the package: th... more >>
Bulk Insert of XML of two level of hierarchy
Posted by mvp at 3/29/2005 12:41:06 PM
Hello,
I want to load following XML into one sql table .
Pls let me know, how can i load it..My XML file will be 60 MB so i want to
do BULK insert.
It is a two level of hierarchy. Project
can have multiple Activities.. so one project will have multiple Activities
rows. so in table i want ... more >>
bulk insert
Posted by Vince
Hi there !
a pretty silly question about bulk insert...
i'm trying to insert data into a table, but the first field is
quotation marked..so I wrote this in the fileformat
8.0
2
1 SQLCHAR 0 0 "" 0
dum1
2 SQLCHAR 0 50 "\"" ... more >>
trying to return 2 decimal places (getting errors)
Posted by meg at 3/29/2005 12:16:26 PM
I am trying to return a percentage as follows:
Select Name, 'Percent' =
case when sum(ColB) = 0 then convert(decimal(4, 2), 0) else
convert(decimal(4, 2), round((convert(decimal(14, 6), sum(colA)) / convert(decimal(14, 6), sum(colB))) *
100, 2))
From Table 1
Group By Name
However i get ... more >>
Showing the status of SET options
Posted by DWalker at 3/29/2005 11:41:16 AM
Every language's SET command should have a corresponding (simple, direct)
Query or Show command. I'm sure SQL has a way to find the value of its SET
options, but I can't find it at the moment. Something about database or
connection flags, if I remember right.
How do I determine, using T-S... more >>
How to get identity from parent Table and insert it into the child table
Posted by RayAll at 3/29/2005 11:29:19 AM
I have a table with the following schema
F_NAME L_NAME COURSE_ID COURSE_DESC
this table contains 10 records ,and I need to insert these records into 2
tables .TBSTUDENT and TBCOURSE.
in TBSTUDENT ,I have student_id which is an identity column and in TBCOURSE
,I have a foriegn key to thi... more >>
SQL Format?
Posted by John Riddle at 3/29/2005 11:26:00 AM
Hello,
I've got the following statement that executes fine in Query Analyzer:
SELECT "urn:schemas:httpmail:to" Recipient, "urn:schemas:httpmail:fromemail"
Sender, "urn:schemas:httpmail:subject" Subject,
"urn:schemas:httpmail:hasattachment" Attachments,
"urn:schemas:mailheader:date" SentD... more >>
When to commit/rollback transaction
Posted by Griff at 3/29/2005 11:24:59 AM
I'm creating an SQL script that creates many tables and stored procedures.
I've created an outer transaction for the whole lot and am creating an inner
transaction around each bit of SQL that generates a table or a stored
procedure.
Pseudo code:
--------------------------------------------... more >>
ordering temp table data upon insert
Posted by JT at 3/29/2005 11:23:40 AM
how can i get around this problem? i need to create a temp table to hold my
data in a specific order, but i also need to have an identity field
generated as an autonumber so that i can loop through my temp table records.
i think sql server throws an error due to the combination of the order by... more >>
Find minimum value in a list
Posted by Patrix317 at 3/29/2005 10:45:03 AM
How do I find the minimum value in a list if provided in a function?
For example: FindMin('323', '29', '991')
The answer should be '29'.
I could pull this off by comparing each value to the other until I determine
which is the least value. Although I have experience in other languages, I'... more >>
Why Windows Authentication?
Posted by Jason Mauss at 3/29/2005 10:33:36 AM
Most of the security-related things I read about SQL Server says you should
run Windows Authentication only. Why is that?
If you run Windows Authentication only, does that stop you from implementing
application roles and stuff like that?
... more >>
syntax to use var as ColumName in Tsql?
Posted by Ron at 3/29/2005 10:14:19 AM
Hello,
Is there a syntax for using a variable for a column name?
Example:
Declare @fldName varchar(20)
Set @fldName = 'fld1' --say fld1 is an int column
Select @fldName From tbl1
This yields
No Column Name
fld1
fld1
fld1
....
Instead of
fld1
827
245
248
....
In ADO I ... more >>
create table question
Posted by Nikhil Patel at 3/29/2005 10:01:37 AM
Hi all,
I bring data from 15 different files into several SQL Server tables every
night. I first bring data from CSV file and store them into 15 different
intermediary tables. Then I execute stored procedure that imports data from
intermediary tables into the tables that our users use.
... more >>
case in HAVING statement
Posted by simon at 3/29/2005 10:01:05 AM
How can I include case in having statement:
........
HAVING case when @korak=3D1440 then (T5.fromTime is not null AND =
T5.toTime is not null) else
((T5.fromTime is null AND T5.toTime is null AND T5.izd_nivo is null) OR =
(T5.fromTime is not null AND T5.toTime is not null)) end
This isn't w... more >>
trying to show results in percentages
Posted by meg at 3/29/2005 9:33:03 AM
how can i divide 2 numbers and show the result as a percent (or at least decimal form)
ie. when i do:
print 5/10
the result is 0
... more >>
Transactions across databases.
Posted by Sam Davis at 3/29/2005 9:33:03 AM
I have two seperate databases hosted on the same SQL Server. I had an issue
last night where a open transaction kept process' on the second database from
running. Any idea on why that would be? Shouldn't they be two seperate
environments?
Thanks to anyone who can shed some insight on the in... more >>
Full Outer Join & Very Slow Query
Posted by milan_vaclavik NO[at]SPAM centrum.cz at 3/29/2005 9:03:58 AM
Hello,
I have got the following problem. I have created the table "Old" (with
fields a,b,c,d,e,f,g,h) which has about 100 mil. of records now. The
query "New" (with the same fields) is a very complex & slow query
based on lots of other tables, parameters and subqueries. It returns
always abou... more >>
Reading another DB into SQL Server
Posted by Maury Markowitz at 3/29/2005 8:53:06 AM
We have a product based on a third-party database. The DB is accessable via
SQL, but uses an interpreter bolted on top of their ISAM engine, and it's
very slow. The big problem, however, is that we can't use our SQL tools, like
Query Analizer, against the data, and we are forced to use Access ... more >>
split address field into Addr1 and Addr2?
Posted by tommcd24 at 3/29/2005 8:41:09 AM
I need to split a single address field which combines street address, PO Box
and Suite #'s etc. into Addr1 and Addr2 fields.
Is there a TSQL function that I can use? I'm think something along the lines
of the .NET Split() method...
Unfortunately the data isn't uniform in length, so Substri... more >>
update sproc fixed (but how?)
Posted by Steve'o at 3/29/2005 8:05:02 AM
update sproc fixed (but how?) SQL Server 2000 SP3a
Does a sporc with two update..sets and one insert..into have to be arranged
in a certain order?
I posted a question a week ago with regard to a sproc where the update
appeared to be doing nothing, this post is to say that I've fixed it, bu... more >>
View updatable in EM - not updatable in ADP (2003)
Posted by Norbert Meiss at 3/29/2005 7:29:10 AM
Hi,
what could be the reason for this behavior, and is there a general solution?
Thanks,
Norbert Meiss... more >>
Converting Profiles to Stored Procedures
Posted by Rich at 3/29/2005 7:27:04 AM
New to SQL Server. I am considering converting my Profiles that I run to
Stored Procedures. I am listening for long running querys and some other
things. If I use just the Profiler, I can look at the all the databases in
the server at the same time. However, if I convert the profile to a s... more >>
access project front end and SPs
Posted by Italian Pete at 3/29/2005 6:45:03 AM
Hi,
I have recently upsized an Access database to SQLServer. This has required
me rewriting the majority of the queries.
My question is this: How do I reference a control on an Access form in an
SP. (I have a query whose WHERE statement requires a value input by the user
on a form).
... more >>
Convert EXISTS to JOIN or?
Posted by mawi at 3/29/2005 2:48:18 AM
Hello!
I have a query I cannot find a solution to.
Structure: Nodes transferring units. One nodes table with
info. It is related to itself, so that a node can have many
sourcenodes.
.-----.
|xfers|----+
`-----' |
| |
| .--+--. 1.* .---------.
|-----+node... more >>
Combining Time with a Date
Posted by BobRoyAce at 3/29/2005 1:56:51 AM
Let's say that I have two tables, one of which has a StartDate field (say,
TableA) as well as a foreign key reference to TableB which has a field
called BeginTime. Suppose that values in TableA.StartDate field have varying
dates together with a time of 00:00:00.000 (as it's a datetime field) a... more >>
|