all groups > sql server programming > may 2006 > threads for wednesday may 10
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
assigning xml output
Posted by kishor at 5/10/2006 11:17:02 PM
I have a small question.
I am recently started using 2005 and I want to assign results of following
query in to a variable of any type.
select top 1 * from dbo.authors for xml auto
Please let me know how do I achieve this.
Kishor... more >>
Reporting Solutions for .NET w/ SQL Server
Posted by Spam Catcher at 5/10/2006 10:58:11 PM
I've posted this to the .NET groups... but I thought maybe some people in
the SQL Server forums could also give me some feedback.
Thanks : )
Hi all,
We're looking at upgrading our VS.NET Crystal Reporting solution with
something more powerful and user friendly. The reporting solutio... more >>
Table creation script
Posted by MUKUT at 5/10/2006 9:42:09 PM
All,
Any one knows how to find out the table creation script - means,you
have a table name and you are required to see the texts which created
the table.For example,
MySQL
SHOW CREATE TABLE <table_name>
It returns the script.
ORACLE
SELECT dbms_metadata.get_data('TABLE', <'table_name... more >>
Comparing data model
Posted by MUKUT at 5/10/2006 9:23:03 PM
All,
An up gradation is going on in my project. Here, I have some tables
in a project specific database and the same (w.r.t name) set of tables
(but the modified one) in a different database. We are using
sqlserver2000.
Now I need to find out what are modifications- means the name &
featur... more >>
Newbee needs help
Posted by Raymond Du at 5/10/2006 8:03:02 PM
Hi,
I have the following statement:
select
dbo.udfCustomerName(CustomerID)
, Count(*)
from
Orders
group by
CustomerID
If Orders table has 1 million rows, does udfCustomerName get executed 1
million times?
Or does SQL server do the grouping in CustomerID first then call udf
... more >>
process running long
Posted by Vikram at 5/10/2006 7:14:16 PM
Recently i saw sysprocess due to high CPU usage n i find out that some
process are shoing login_time which is 2-3 hours old. Does this mean that
the process is runnig for 2-3 hours ?
... more >>
Deriving numerator and denominator
Posted by ad at 5/10/2006 7:13:02 PM
Hi All,
I need to write a udf which has to get the numerator and denominator from a
decimal value. I have to get the nearest values of numerator and
denominator.
For Ex:
..66 = 2/3
..33 = 1/3
..5 = 1/2
Could anyone please help me in writing the UDF.
Thanks in Advance
ad... more >>
UNPIVOT in SQL SERVER 2000
Posted by NJ at 5/10/2006 5:29:26 PM
G'day Mates,
Is there anyway I can do an UNPIVOT in Sql Server 2000?
Regards,
Nitish
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Problem with using bcp
Posted by Ronald Hermans at 5/10/2006 3:52:28 PM
Hello all,
I try to execute the code below. Whatever I try I get the error:
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'dc_temp_text'.
This also happens when I put the owner and the database name in from of the
table name.
Can anybody tell me what it is th... more >>
variable table name in a function
Posted by Zorpiedoman at 5/10/2006 3:52:01 PM
Here is what I want... is there ANY way to do it? (without using temp tables)
-------------------------------------------------------------------------
Create Function dbo.MakeThisWork(@TableName varchar(300))
Returns varchar(8000)
AS
Begin
Declare @S varchar(8000)
Select @S = (Select Descrip... more >>
insert image
Posted by Geo at 5/10/2006 3:46:31 PM
Can any one point me in the right direction on how to insert an image into
SQL server using ASP ?I was thinking a long the lines of using the
ADODB.Stream as I cant use any upload activeX components or any other third
party components, but cant seem to find the info I'm looking for. I don't
want... more >>
Sending an Attachment using XP_sendmail
Posted by jaylou at 5/10/2006 3:29:02 PM
Hi all,
I know it is possible to send an attachment thru XP_Sendmail.
The file name will change everday due to the date in the file name. so I
created a variable to hold the file location and name. when I run the below
I get an error:
Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed... more >>
View OR Select Query
Posted by imtiaz at 5/10/2006 3:22:00 PM
View or Select Query which will work faster while querying from multiple
tables
Regards
Imtiaz
... more >>
Right-justify a column on export to text
Posted by Pancho at 5/10/2006 3:05:02 PM
Hello, I have a column (AccountNo per the below create script) that displays
properly with leading zeroes to fill a 22-character column while in SQL.
However, when I use a DTS export to a standard text file with no
transformation, it left-justifies. Could someone pls advise how I can get it ... more >>
When was a database last used?
Posted by Rudi Larno at 5/10/2006 3:02:00 PM
Hi,
How do I (programatically) find the last date/time the database was used.
Even better would also be to find how much time the database has/is being
used.
Some background:
I'd like to write a custom tool to clean out some of our development
database servers. These constantly get fille... more >>
Trigger Question
Posted by msnews.microsoft.com at 5/10/2006 2:59:43 PM
Ladies / Gentlemen
I have several different programs that Insert/Delete/Update data in
a MS SQL2000 database. I currently have an audit trigger on each table.
I have added a field to the audit file named 'UpdatingProgram'. Now
I need to know if I can fill in the Name o... more >>
RETURN @@ERROR?
Posted by Don Miller at 5/10/2006 2:49:27 PM
If I execute one SP within a parent SP and want to trap and return an error
code from the child SP, can I just use RETURN @@ERROR in the child SP rather
than capturing @@ERROR in a local variable first? Or does the successful
completion of the RETURN statement set @@ERROR back to 0 by the time it... more >>
truncate all user tables from the db
Posted by Test Test at 5/10/2006 2:46:15 PM
I am trying to trucnate all user tables from the db. The code does not
seem to be working though. Any idea?
Thanks for your help.
declare @sql varchar(500)
set @sql = 'select ''TRUNCATE TABLE dbo.''+ name+ char(13)
from sysobjects
where type=''U'' AND
objectproperty(id,''ismss... more >>
terminal session
Posted by mkv at 5/10/2006 2:00:02 PM
Hi
I was wondering is there any way to determine Terminal Session Name in
stored procedure/functon. Please don’t confuse my question with result of
HOST_NAME(), I’m not looking for Terminal _SERVER_ name i’m looking for a
name of current TS
session.
I would highly appreciate respo... more >>
Group by
Posted by Sandra at 5/10/2006 1:58:02 PM
create table my_table (
col1 char10,
col2 char10,
col3 char 10)
select col1, count(*)
from my_table
group by col1
--Now, from this group by results, I want to eliminate all the records where
col2 is Null. Can I accomplished this in the same group by query above?
Remember, I want to el... more >>
Group By
Posted by Sandra at 5/10/2006 1:56:02 PM
create table my_table (
col1 char10,
col2 char10,
col3 char 10)
select col1, count(*)
from my_table
group by col1
--Now, from this group by results, I want to eliminate all the records where
col2 is Null. Can I accomplished this in the same group by query above?
Remember, I want to el... more >>
Warning: Null value is eliminated by an aggregate or other SET ...
Posted by Brad Ashforth at 5/10/2006 1:51:01 PM
re: Warning: Null value is eliminated by an aggregate or other SET operation
I have read Microsoft's article 317312 and think I understand what is
happening and why I can ignore it. My understanding is that because the
subquery is returning a null value (because the subquery returns no recor... more >>
Adding Date and zero values to non existent dates
Posted by Frenchie418 at 5/10/2006 12:40:02 PM
Hi,
I have info about my customers and when they place their orders. I am trying
to get a report that will tell me the sum of their orders for each month for
the last 24 months. The problem I'm having is that certain customers don't
have order in every month so I'm only able to query on what... more >>
Transform record to 2 column table with 1) col name & 2) col's da
Posted by malcolm at 5/10/2006 12:19:02 PM
I am creating separate report for persons participating in atheltic events in
Chicago this summer. Each event has its table & 1 or more columns including
the participant's ID.
The report needs to turn the col names and data for a given record into a
vertical 2 column list.
I want a gener... more >>
Generating sql script by using code.
Posted by Roy Goldhammer at 5/10/2006 12:00:54 PM
Hello there
I've created store procedure that returns list of all views on the system
according to depedent tree. (if view2 is based on view1, view1 will be
before view2)
Now i want to get the script of each view, so i can build script of all
views by the dependent tree.
The option of... more >>
How To Raise Prices Without Losing Sales
Posted by jbgbavnfcduf NO[at]SPAM yahoo.com at 5/10/2006 11:39:03 AM
The secrets of making customers HAPPY to pay HIGHER prices.
Raising your price will have a HUGE impact on your bottom line.
12 "invisible" ways to raise prices.
Do you offer coupons? Rebates? Discount promotions?
"Tweak" what you offer - so you can price higher.
"Packaging" changes that increas... more >>
Text Field - Beginners question
Posted by John at 5/10/2006 11:25:52 AM
Hello
What is the best way to large text fields in a table, where the text fields
are upto 5000 characters ?
Regards
John
... more >>
update table from one to another with max(date) value
Posted by karenbran at 5/10/2006 11:14:41 AM
The statement below is actually what I am trying to accomplish:
I have two tables usr_inventtable, inventtrans
i need the calculated value of the fields
(costamountsettled/qtysettled) in the inventtrans table put into the
field lastcostprice in the usr_inventtable,
but i need only the l... more >>
where is this transaction coming from?
Posted by jemkem NO[at]SPAM yahoo.com at 5/10/2006 10:59:15 AM
I have a sproc that does this (among other things):
insert #tbl exec linked.db.dbo.sp @beginDate, @endDate, @salesperson,
@customer
I'm not sure what's changed, but SQL Server started complaining that
[OLE/DB provider returned message: New transaction cannot enlist in the
specified transa... more >>
Converting problem
Posted by Roy Goldhammer at 5/10/2006 10:53:47 AM
Hello there
I'm imporing data from csv files.
one of the field with data lile '20060105' should be converted to date.
Vbscript isdate function cannot convert it to date, but sql server can
convert it.
Does someone knows whay?
... more >>
update table with Max(date) value from another table
Posted by karenbran at 5/10/2006 10:12:51 AM
this is my code and i keep getting an error ( ',' on line 4) and I
cannot figure out what is wrong with this code.
Sql 2000 server
INSERT INTO USR_COSTPRICE
(ITEMID,DATEPHYSICAL,QTY,DATEFINANCIAL,QTYSETTLED,COSTAMOUNTSETTLED,
VALUEOPEN,DATAAREAID)
SELECT
ITEMID,DATEPHYSICAL,QTY,DATE... more >>
Dynamic SQL
Posted by Yan at 5/10/2006 10:09:51 AM
Hi,
I have the following proc which works with EXEC and I now woauld like to
replace EXEC with sp_executesql and fell to do so. The sp compiles and in
run-time I get the bellow error:
Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.
ALTER PROCEDURE RawChannelRate... more >>
help with update query needed
Posted by Tony Cook at 5/10/2006 10:02:02 AM
Could anyone help me with an update query? I need to populate Table 1
(bookings) with data from Table 3 (defaults), via a joining field in Table 2
(enquiries). All fields are of type INT, using SQL Server 2000.
Table 1 (bookings):
id, t_val, q_val
Table 2 (enquiries):
id, booking_id, enq... more >>
Temp Tables In SP with ASP
Posted by Jim at 5/10/2006 9:41:02 AM
Im noticing that whenever I use a temp table, whether its a regular temp
table or a table variable, my record set in ASP comes up with this message:
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
Is there a work around for this...I really need to be... more >>
Adding parameters to a function which returns a table
Posted by Will at 5/10/2006 9:20:43 AM
Hi Guys,
I've got an issue adding a parameter to a function, when I do using it
an alter statement SQL Server 2000 complains that incorrect number of
parameters are specified. I remember reading a while back that you
can't use alter like this if the function returns a table, since then
I've a... more >>
Creating a formated text file from a query
Posted by Ronald Hermans at 5/10/2006 9:05:12 AM
Hello all.
I'm not highly experienced with SQL programming. I must export to contents
of a table to a formated text file which is then send to the customer. Is
there a possibility to do this from within a sql statement?
TIA
Ronald
... more >>
Interesting Behavior of Alter Table
Posted by StevenBr at 5/10/2006 8:56:02 AM
We've found something that seems odd for which we'd like an explanation.
We have a table defined as follows:
create table tester
(col1 int, col2 char(2), col3 int)
Our script executes something like this:
begin
alter table tester add id int not null constraint df_test default 0
a... more >>
Is there a recommended size limit to an SQL Program ?
Posted by rmcompute at 5/10/2006 8:54:02 AM
I wrote a program with 546 lines. When the code was run to line 406, it took
2 minutes and 9 seconds. When it ran all the way through, I stopped it after
9 minutes. I ran just the section from line 406 to the end and it ran in 20
seconds.
For some reason, when all of the code is run togeth... more >>
Assigning the results of a table function to a table variable
Posted by Bob at 5/10/2006 8:36:02 AM
SQL Server 2K SP1.
I'm trying to put the results of a Table function into a Table variable for
use in a Select. My code is:
DECLARE @LoanTable table (LoanNo DECIMAL(10,0), PRIMARY KEY (LoanNo))
SET @LoanTable = UDF_GetLoansInDeal (1, 8)
SELECT LoanNo
FROM UV_Tran016 AS t16
INNER JOI... more >>
bcp or oledb/ado?
Posted by nick at 5/10/2006 8:23:01 AM
I have very big tables. And I need to some computation for each row. Which
one is the best/fast way to implement it?
1. bcp the tables to text file. C++ code parse the csv file row by row.
Write results to text files. Then bulk insert back to Sql server.
2. C++ code use oledb/ado to get t... more >>
ROWLOCK usage
Posted by kh at 5/10/2006 8:12:01 AM
hi. i don't have much experience with locking using lock hints so wondered if
someone could help me with usage of ROWLOCK. i am writing a number of procs
which will perform validation on data prior to performing updates. i need
read consistency for the duration of these procs whilst guaranteei... more >>
Fully Qualified names?
Posted by Colin Dawson at 5/10/2006 8:10:28 AM
Hi all
A collegeue recently found an item on
http://www.sql-server-performance.com/stored_procedures.asp (do a search on
the page to "fully qualified name")
In theory this does make sense, and I can understand what the item is
getting at. I work with a team of 20 developers, and we had n... more >>
Need some help!
Posted by Viccu at 5/10/2006 7:13:02 AM
Hi All
I want to blow up the database. Say I have 10 records in a particular table
and I want to increase it to 100 records for performance testing purposes. Is
there a way to do it in SQL Server?
Thank you
Viccu.... more >>
BLOB performance SQL 2005 Do's and Don'ts
Posted by km200281 at 5/10/2006 6:32:51 AM
Hi,
I have a content based site with over a 1000 downloadable word docs
which are currently stored on a server filesystem.
however these are split in muliple folder paths for different clients
and i am trying to find a more efficient way of doing this. i have
been looking into storing the fi... more >>
Why is Job slow
Posted by Lasse at 5/10/2006 6:15:47 AM
Hi, I have a job scheduled, it executes a stored procedure which in turn
contain other stored procedures and some sql that gets executed.
The job takes approx 5hours to run, but when I run the stored procedure in
sql query analyser it takes only 20 minutes, why the extra time when run in
a jo... more >>
"Query Cost (relative to the batch)" in Query Analyzer
Posted by smithabreddy NO[at]SPAM gmail.com at 5/10/2006 5:32:30 AM
Hi,
I'm trying to troubleshoot a slow-running query which is part of a
stored procedure. When I run the query as it is - it takes 53 seconds
to run.
-------------------------------------
Example original query:
SELECT DISTINCT SP.SP_ID
FROM StandardProject SP
INNER JOIN Classes cls ON SP... more >>
problems with sp_makewebtask(replaces the tags for nothing )
Posted by FHR at 5/10/2006 4:49:02 AM
Hi,
i have a code that uses makewebtask and it works fine in development
enviropment (SQL SERVER 8.00.760(SP3)), when that code is uploaded to
production it doesn't works fine(the tags where data must be inserted,
appears in blank, no data is inserted in template file).
production server ... more >>
count
Posted by farshad at 5/10/2006 2:39:02 AM
Hi,
There is a select query which returns a count as below:
select
@count = count(typecode)
from
tbl_Types
where
typecode = @typecode
depending on the count, this is what needs to be done...
If there is a count of 1 to 26 then I would like to use A-Z and then
anything from 26 o... more >>
Sequence Number Generator
Posted by Peter Larsson at 5/10/2006 2:14:02 AM
Please enjoy and feel free to adjust to your specific needs!
If you find a way to optimize the function further, just reply with your
code fix.
CREATE FUNCTION dbo.fnSeqNumbers
(
@LowLimit INT,
@HighLimit INT
)
RETURNS @Values TABLE
(
Value INT
)
AS
BEGIN
DECLARE @T... more >>
help with Query please
Posted by Niclas at 5/10/2006 1:23:02 AM
Hi,
I have a table with (sports) results, containing an userID, EventId and
a Time for each result recorded.
How do I select a list ordered from fastest to slowest containing the
fastest time for each userID recorded ? The challenge here, that I don't
understand how to do is to not get a li... more >>
bulk insert
Posted by aa at 5/10/2006 12:41:24 AM
This is my sample text file
Axxxxx, Lxxx 11-02-48 58 S1111-02 1-Feb-06 d22 mfc
203.3 12455 124-42-1245 f 401 Taaddd Dr xxxxx Cxxxxx
xx 8xxxx XX
Bxxxxx, Lxxx 11-03-48 58 S1111-03 2-Feb-06 d22 mfc
203.3 12455 ... more >>
sql search
Posted by farshad at 5/10/2006 12:24:02 AM
Hi,
I am writing a sql query for something like a data entry address search.
One of the fields is Postcode.
What I am trying to get working is the spaces that the users can enter
between the postcodes.
For example, a postcode in London is like: TW12 YRZ
Notice that there is a space. But anoth... more >>
T-SQL help desperately, desperately needed
Posted by champ.supernova NO[at]SPAM gmail.com at 5/10/2006 12:14:58 AM
First of all, I sincerely apologise for posting this question again - I
normally wouldn't post a duplicate, but I submitted this question
yesterday and only got one reply; however, I desperately, desperately
need to find a solution for this as I've been banging my head against a
brick wall for s... more >>
|