all groups > sql server programming > march 2007 > threads for thursday march 8
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
retrive user defined tables from a database
Posted by kishore raman at 3/8/2007 10:41:12 PM
Can any one tell me, how to display only user defined tables from a database.
for eg:) if you give,
Select * from sysobject from table_type='U' will display all the tables, which includes system table too.
Now i need to display only user created tables only, wats the query for it.
Please h... more >>
db mirroring
Posted by Carlos Sacristan at 3/8/2007 9:39:55 PM
Hi all,
I'm trying to install db mirroring on my laptop with 2 sql server
standard and an express as witness, but I couldn't because I receive always
the same message: "Neither the partner nor witness server instance for
database TestDB is available". I think the problem is with por... more >>
split sp
Posted by obelix via SQLMonster.com at 3/8/2007 6:37:32 PM
olá
I am STILL trying to splits funds depending on their availability in a pool
of funds
based on a priority list with 1 being highest. In the example I need to
split 1000 'ABC' and I achive this by looking at the priority list, going to
the
pool tbl and allocating whats available based on a... more >>
UPDATE query: possible to do search/replace on existing string?
Posted by Jen at 3/8/2007 6:10:55 PM
Is it possible for an UPDATE query to just do a search and replace on a
string value instead of replacing the entire string? For example, if a
record's string was "N12:0" could the update query just replace the N12 part
with something else?
... more >>
Keeping Local recordsets - is it an effective way to program?
Posted by Sandy at 3/8/2007 6:02:00 PM
Hello -
I would like some opinions on whether an application using VB6 and Sql
Server 2005 should utilize creation of local (client) recordsets; the theory
being that opening and closing a connection quickly and then just moving
backwards and forwards in the recordset on the client machine ... more >>
Groupby question
Posted by Blasting Cap at 3/8/2007 5:15:30 PM
I have a table with the following data in a varchar field (the "10
01-2007" below) and a number (units).
10 01-2007 150
11 01-2007 300
12 01-2007 575
14 01-2007 25
21 01-2007 50000
22 01-2007 25000
31 01-2007 8700
51 01-2007 330
I need to combine the ones with 10, 11 & 12 into one lin... more >>
Encrypted SP's
Posted by Smokey Grindel at 3/8/2007 4:24:53 PM
not sure how this happened but it happened on SQL Server 2000 before we
upgraded to 2005 with SP2, but now 3 of our stored procedures have a lock on
their icon and are marked as encrypted... how can I recover these? I need to
edit them and cant because of that! Thanks!
... more >>
Trying to implement a function ...
Posted by Jamie Risk at 3/8/2007 4:00:37 PM
I have two tables, and a query that is used many times. My
attempts at creating a function that returns the result of the
query isn't working.
How can I implment a function "fProtocol()" that will operate on
the two tables below with the query I've shown?
- Jamie
CREATE TABLE Protocol ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
constraints and udfs
Posted by John Grandy at 3/8/2007 3:33:14 PM
Apparently it is not possible to call UDFs from constraints.
Or is there a clever workaround ... ?
... more >>
sys.dm_exec_query_stats and Logical Reads
Posted by Amos Soma at 3/8/2007 3:13:22 PM
I am using the sys.dm_exec_query_stats view to get a handle on which queries
on our server are taking the longest to execute. One of the columns I am
using to determine query efficiency is last_logical_reads. As I understand
it, this is the number of logical reads the particular query performe... more >>
Working fine locally but not link server
Posted by Ken at 3/8/2007 2:52:50 PM
when I worked on query using transaction such as rollback, save, and,commit
for local database then it works just fine.
however I tried to do same thing for licked server it returened a error
message like below.
Cannot promote the transaction to a distributed transaction because there ... more >>
Help with Order By clause.
Posted by CharlesC at 3/8/2007 2:33:42 PM
Hello,
I have the following table (Ter is territory, R is Rate):
Ter1 R1 Ter2 R2
Z 2 K 3
K 3 Z 4
Z 3 K 2
I am looking for the Order By clause that will give me for territory Z:
Ter1 R1 Ter2 R2
K 3 ... more >>
Need help optimizing a batch query
Posted by 0to60 at 3/8/2007 1:52:45 PM
I have a sproc that will return several tables, and it looks something like
this:
SELECT * FROM TABLEA WHERE somelongasswhereclause
SELECT * FROM TABLEB WHERE TableBID IN (SELECT foreignKeyToTableB FROM
TABLEA WHERE somelongasswhereclause)
SELECT * FROM TABLEC WHERE TableBID IN (SELECT ... more >>
Check primary key then insert
Posted by Drew at 3/8/2007 1:22:39 PM
I am working on an SP to insert data from an ASP page. I would like it to
check for a record with the submitted primary key, if it is not present,
then insert, if it is present then return an error message. The following
SP does what I want it to, but it does not return an error message.
... more >>
Return messages a problem in apps? (Column rename)
Posted by Claudia at 3/8/2007 12:34:03 PM
I have a stored procedure that executes sp_rename. The default message
"Caution: Changing any part of an object name could break scripts and stored
procedures."
Two questions:
Will this message hinder applications?
Is there any way to disable the messages?
(I have NoCount on)
Sample p... more >>
SQL Query Compare
Posted by tarheels4025 at 3/8/2007 12:26:13 PM
Is there anyway to run a query and then compare the results with a row in a
different table? If this is possible please show me what it might look like
structure wise. Thank you.... more >>
xp_sendmail and operators
Posted by Test Test at 3/8/2007 12:24:30 PM
Can SQL operators be called form "xp_sendmail" stored proc?
xp_sendmail
@recipients = 'DBA'
Thanks for your help.
*** Sent via Developersdex http://www.developersdex.com ***... more >>
xp_getfiledetails
Posted by Bill Scrivener at 3/8/2007 11:47:38 AM
I have used xp_getfiledetails on SQL2000 for several years. Now that we are
upgrading to SQL2005, I find out that xp_getfiledetails is no longer
supported.
Has anybody found a workaround for this? If so, will you please share.
Thanks in advance.... more >>
Table joins??
Posted by MittyKom at 3/8/2007 11:46:09 AM
Hi All
I have two tables that are supposed to have the same records and i would
like to get those records in Tab2 that are not in Tab1. The records are
uniquely identified by a combination of column Id1 and Id2 in both the
tables. Below is what i have tried and i am not getting the record... more >>
How to group by a boolean expression
Posted by Xenomech NO[at]SPAM gmail.com at 3/8/2007 11:37:41 AM
In MSAccess, I can execute the following query:
SELECT
SUM([MyField]) AS SumMyField
FROM
[MyTable]
GROUP BY
[MyOtherField]=13
However, MSSQL conks out at the '=' operator in the "group by"
clause. Is there a way to write such a query for MSSQL that will work
the same way ... more >>
Group count and Total count in one SELECT
Posted by Stephane at 3/8/2007 11:37:39 AM
Hi,
Is there a way to get the group count and the total count in one select?
Something like this (which doesn't work):
select count(products) as totalProduct, sum(count(*)), products
from tbl_products group by products
So I would have
productA 10 100
productB 50 100
productC 40 100... more >>
Restore and backup script questions
Posted by gv at 3/8/2007 11:36:02 AM
Hi all,
Using SQL 2000 SP4
I have a bak file where when I back up I have RETAINDAYS = 10.
Well I'm changing that to 3 days. So how do I get rid of old sets that I
don't need in the bak file?
And how do I always restore in the scrip below the most current backup set?
File = 1 doesn't wo... more >>
Query to give me list of dbs + db size
Posted by Hassan at 3/8/2007 11:09:42 AM
How can I get a query that i can run against a SQL Server to get a list of
dbs and its size such as
Name Total DB Size Allocated DB Usage Total Log Size
Allocated Log Usage
DB1 120GB 100GB 20GB
1GB
DB2 1GB ... more >>
How to set string default value for column of type nchar
Posted by docw at 3/8/2007 11:00:03 AM
Hi,
For a column of type nchar of length 2, is it possible to give a value of
"04", or "01" ?
In SQL server Express 2005 if I type the value "04", the value saved is
always "4" or "1". It loses the zero left padding.
--
DocW... more >>
Number of Databases
Posted by CLM at 3/8/2007 10:37:00 AM
I've got a four-way, 4G RAM 2000 SP4 server that is experiencing timeout
issues and so far I haven't been able to find the root of the problem. We're
looking at memory, disk i/o, etc. but without any luck yet. One thing that
is unusual about this server is that it has a lot of databases: 26... more >>
Is there an inverse of DatePart function available in t-sql - DateTime(month, day, year) ?
Posted by Jia at 3/8/2007 10:33:47 AM
I'd like to get the date given the month, day, and year (3 integers).
... more >>
Is this a kludge?
Posted by rvgrahamsevatenein NO[at]SPAM sbcglobal.net at 3/8/2007 9:58:48 AM
I have a relationship between two tables, one is purchase order items
and the other is invoice numbers. The items don't have to have an
invoice number, at least when they are first ordered, but I do want to
validate that they are assigned a valid one from the invoices table
when they later acqui... more >>
Query Help
Posted by Mangler at 3/8/2007 8:52:57 AM
Here is the query first:
USE reclaim
GO
SELECT o.sku, o.order_desc, o.order_qty, o.open_dte, o.created_ini,
o.order_qty - sum(s.rec_rr + s.rec_sprint + s.new_rr +
s.new_sprint) As 'owe',
sum(s.rec_rr + s.rec_sprint + s.new_rr + s.new_sprint) As
'ship',
datediff(d,(o... more >>
syntax help please for case function
Posted by rodchar at 3/8/2007 7:26:55 AM
hey all,
how do i convert the following if statments to a case statement:
if a=1
begin
end
if a=2
begin
end
if a=3
begin
end
thanks,
rodchar... more >>
Trying to write a procedure in SQL Server 2000 to write to/update a table
Posted by jrheltmach NO[at]SPAM michaelbest.com at 3/8/2007 7:24:16 AM
Hi all, I'm looking for some help in writing a stored procedure. I'm
new to SQL Server so this may seem rather elementary, (well it is to
me) so here goes....
I'm trying to select a bunch of records from multiple tables, create
totals on a couple columns and then post this aggregated data int... more >>
Joining tables between databases
Posted by SouRa at 3/8/2007 5:56:03 AM
Hi all,
I am joining tables between two databases.
Will it affect the performance?
Please advise
Thanks
Soura... more >>
how to select the required result
Posted by junior at 3/8/2007 4:32:37 AM
Hello,
I have the following query,
SELECT DISTINCT GroupInfo.GroupID,
GroupInfo.GroupName,GroupInfo.ParentGroupID
FROM GroupInfo INNER Join DeviceGroup
ON(DeviceGroup.GroupID=Groupinfo.GroupID)
INNER Join Deviceinfo ON
(Deviceinfo.SerialNumber=DeviceGroup.SerialNumber )
It results... more >>
xp_startmail: failed with mail error 0x8004010e
Posted by Dimi at 3/8/2007 3:55:47 AM
Hi all,
Yesterday we changed the account for the sending of emails and sending
out an email is not any more possible.
All needed steps are done to set up this new account.
Already checked with Outlook if something strange with the account is
happening,
but haven't found anything [I can s... more >>
Barcode in Reporting Services
Posted by Rafael A. M. Borges at 3/8/2007 3:48:29 AM
People, how can I make barcodes using Reporting Services 2000?
Thanks
... more >>
Error 511 while not exceeding 8060 characters
Posted by Bart Holthuijsen at 3/8/2007 3:37:03 AM
Hi all,
I'm getting the following error while trying to update an ntext column in a
table:
Server: Msg 511, Level 16, State 1, Line 1
Cannot create a row of size 8067 which is greater than the allowable maximum
of 8060.
The statement has been terminated.
Normally, this would mean that... more >>
Date convertion problem
Posted by JRMalherbe at 3/8/2007 3:35:00 AM
We use a CSV to import data into a table (tableBCP) where all the fields
(except the key) are varchar fields. On this table we will do certain tests
before the records are transferred to the final destination table
(tableProcess) with the proper data types.
One of the fields is a 'Date of B... more >>
DISABLE TRIGGER security issue
Posted by Peter Hyssett at 3/8/2007 3:17:08 AM
I am writing a Stored Procedure which updates about 50 tables within a single
Transaction. Four of the tables have triggers which should not be fired, so
before updating these tables I include ALTER TABLE...DISABLE TRIGGER...
statements (and re-enable the triggers after the update)
What w... more >>
Compress Result from sql query
Posted by Rahul at 3/8/2007 2:10:35 AM
Friends,
I have following senario ("#temp Table " )
and follwing result required ("Result Required").
Create table #temp
(
id int,
colA VarChar(4),
colB VarChar(4),
colC VarChar(4)
)
Insert Table #temp(colA, colB, colC, id) Values ('A','','',1)
Insert Table #temp(colA, co... more >>
Compress Result from sql query
Posted by Rahul at 3/8/2007 2:10:21 AM
Friends,
I have following senario ("#temp Table " )
and follwing result required ("Result Required").
Create table #temp
(
id int,
colA VarChar(4),
colB VarChar(4),
colC VarChar(4)
)
Insert Table #temp(colA, colB, colC, id) Values ('A','','',1)
Insert Table #temp(colA, co... more >>
COMMIT TRANS causing timeouts within other procedures
Posted by Rob Greenhalgh at 3/8/2007 12:00:00 AM
Hi All,
We have a stored procedure, which we term as our archiving procedure. It
removes a few million records from our live tables, into these other tables.
There are about 9 tables overall.
While the stored procedure is calculating what to move, everything is fine.
However, once it st... more >>
using the log file to find problem
Posted by Roy Goldhammer at 3/8/2007 12:00:00 AM
Hello there
I have sql server 2000 Standard SP4
I have some process that update some field in my database.
After checking all the procedures i found only one procedure the update this
field, but i didn't find the point where this procedure is running and what
are the parameters that send.... more >>
How to debug a stored Proedure?
Posted by Sugandh Jain at 3/8/2007 12:00:00 AM
I want to debug the stored procedure call, as we get to debug the methods...
I have all the database credentials.
while executing the stored procedure from SQL server Management Studio
Window ,for same set of parameters the SP, is executing Fine.
While calling it from the code, with same ... more >>
|