all groups > sql server programming > december 2004 > threads for tuesday december 21
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
getdate() as only gets Date , not time . How ?
Posted by hoz at 12/21/2004 9:24:49 PM
Inserting line breaks (\n) in SQL DB
Posted by TomTom at 12/21/2004 8:15:54 PM
Hi,
I am trying to insert the text below to the SQL DB using ADO.NET. I have
trouble inserting the '\n' character to the database as it is, meaning I
want to show \n in the result grid in Query Analyzer for example.
---------------------------------------------------------------------------... more >>
Open Cursor with resultset from SP
Posted by Alex Clark at 12/21/2004 8:03:04 PM
Hi All,
I want to do something along the lines of....
DECLARE MYCUR CURSOR LOCAL FOR
EXEC RETR_SHIPS @MINDATE, @MAXDATE
....where RETR_SHIPS is a Stored Proc with the following code...
SELECT * FROM SHIPS WHERE CREATED BETWEEN @MINDATE AND @MAXDATE
TSQL doesn't seem to like the... more >>
sp_xml_removedocument on Text Feild
Posted by David at 12/21/2004 7:19:02 PM
All
I have a text feild in a table that contains the contents of an XML file.
How do I go about using sp_xml_removedocument so that I can use OPENXML to
query each row of the text feild when there are more than 8000 characters in
the feild.
Thanks
... more >>
xp_sendmail sometime work sometime don't in stored prcedure
Posted by andrew at 12/21/2004 6:43:01 PM
I've coded master.dbo.xp_sendmail in my stored procedure. however, it
sometime failed but when run again it pass? Do anyone have this problem too?
How can i resolve this?... more >>
Access -> SQL Migration Perversion
Posted by Mike Labosh at 12/21/2004 6:27:19 PM
Before you all cluebat me, I'm the mop-up-the-mess-guy that they brought in
after the migration flopped last year. I did not design or implement any
part of this Migration. I'm just supposed to mutter some incantation and
fix it...
We have a VB 6.0 program constructed from 85 DTS packages ex... more >>
how to 'join' two tables during insert, without using a cursor?
Posted by Doug Kent at 12/21/2004 6:09:01 PM
Suppose I have two tables:
CREATE TABLE LineItems (
LineItem_ID [int] IDENTITY (1, 1) NOT NULL
)
END
CREATE TABLE LineItems_Timeslips (
LineItem_Timeslip_ID [int] IDENTITY (1, 1) NOT NULL ,
LineItem_ID [int] NOT NULL
)
END
LineItem_ID joins the two tables in a one-to-one relations... more >>
Search inside a XML string
Posted by Star at 12/21/2004 5:45:55 PM
Hi,
I have a TEXT field called XMLString where I'm storing an XML string.
For example, I may have this:
<Company>Thorn Corp</Company>
<Address>101 Main st<Address>
<Notes>A very large company created in 1994. We need to contact them
asap</Notes>
I have enabled Full text indexing on tha... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
very strange stored procedure behavior
Posted by Benjamin Janecke at 12/21/2004 5:35:03 PM
Hi,
im having trouble with a stored procedure. that sp was written some months
ago and has changed several times since then. during these changes it's got
slower and slower. today, i decides to find out whats wrong. so i made a
little vb application that called the sp repeatedly. i noticed ... more >>
Dynamic SQL statement generation
Posted by Zeno Lee at 12/21/2004 4:53:17 PM
Are there pre-existing classes or designs out there to be able to
dynamically generate sql using an Object Oriented framework?
Right now, I have a basic SqlStatement class which wraps a StringBuilder
that dynamically adds joins and where clauses and adds group bys and order
bys but that's i... more >>
Data Layer Merits
Posted by Kevin Munro at 12/21/2004 4:37:44 PM
Hello, now this may be slightly off topic to some extent but as this is a
programming newsgroup I'd like to raise the subject of data layers and
invite your opinions and comments. I suppose this is more a philosophical
design question but here goes.
We have an application using a VB front ... more >>
Help withj Store Procedure
Posted by Divyesh at 12/21/2004 4:17:40 PM
Hi I have written following stored procedure but it take way too long
to complete. I will be processing thousands of records and it is slow.
I am importing data from a source table and adding logic and then
inserting into another table. Any help with speeding it up will be
highly appreciated.
... more >>
How to detect SQL server edition
Posted by Will at 12/21/2004 3:59:07 PM
I need a programmatic way of detecting the edition of SQL Server that is
installed.
I am aware of the "select SERVERPROPERTY('edition')" query, however I cannot
use this as the program that runs the test may not have access to the SQL
Server DB.
I am also aware of the fact that the SQL S... more >>
String Conversions
Posted by datacrunchx at 12/21/2004 3:41:03 PM
Hello
What is the best way to convert a upper or lower string to proper case. In
Foxpro there is a PROPER function or you can parse out the text with the RAT
function. What is the best way in SQL and is there a funcntion??
Thanks... more >>
hex values somewhere in database... help!
Posted by Random at 12/21/2004 3:25:24 PM
I am running some FOR XML EXPLICIT queries off my database to use in my web
page, but I am getting a "hexadecimal value 0x0B, is an invalid character"
error on some of my queries.
That hex value is the vertical tab. I imported the data I am using into the
database. How do I find these hex... more >>
problem with sum
Posted by DC Gringo at 12/21/2004 3:12:59 PM
I'm trying to do grouped sums (or counts) of records based on the specific
day using the following query, but it's not grouping.
select CAST(DATEPART(MONTH,LogTime) as varchar(50)) + '/' +
CAST(DATEPART(DAY,LogTime) as varchar(50)) as LogTime,
Sum(1) as theSum
from ExceptionLog
group by LogT... more >>
How to change database in stored procedure?
Posted by ChowChow at 12/21/2004 2:30:20 PM
Dear all,
I have several database in one sql server and the number of database is
increasing, and in the main database, I write a stored procedure to fetch
data from all other database but I don't want to hardcode the database name
in my stored procedure. I have tried many ways but the prob... more >>
Convert Timestamp into Date and Time columns
Posted by Test Test at 12/21/2004 2:24:29 PM
Hi!
I need to know the SQL that breaksdown timestamp into 2 columns. One
contains the date portion in yyyy-mm-dd format and other contains time
in hh:mm (am/pm) format.
My result would be:
DateCol TimeCol
---------- --------
2004-12-10 00:00:00.000 10:27 am
Thanks for your... more >>
parsing delimited string
Posted by anna at 12/21/2004 2:03:03 PM
table1: user_id, cust_ids (user_id is the key)
table2: user_id, cust_id (both are key)
In table1, the cust_ids is a list of cust_ids delimited by "|". I need to
have a stored procedure to parse the cust_ids field and insert each cust_id
as a row into table2.
input table1:
userA 123... more >>
User Defined Functions
Posted by dwilsontt NO[at]SPAM gmail.com at 12/21/2004 1:42:52 PM
I am using the following query to return the last sale date for an item
set rowcount 1
select @lastsaledate = LastSaleDate from vwSales
where saledate <= @thisweekdate and ItemCode = @itemcode and AmtSold >
0
order by tradedate desc
set rowcount 0
When I try to put this in a user defined ... more >>
comparing data
Posted by Natasa at 12/21/2004 1:29:02 PM
Hi,
Is there a way to compare data for every single column in
two tables ?
Thanks very much,
Natasa... more >>
Unknown Token error in UDF
Posted by Dale at 12/21/2004 12:47:02 PM
I have a query that returns the last sale date for an item
set rowcount 1
select @lastsaledate = SaleDate from vwSales
where saledate <= @thisweekdate
and itemcode = @itemcode and amoutsold > 0
order by tradedate desc
set rowcount 0
When I try to put this into a UDF I get an "UNKNOWN TOK... more >>
Updated Date Query Question with Sample Data
Posted by tarheels4025 at 12/21/2004 12:35:05 PM
Sorry I have been posting so much but here is what I have an example of data
that should be picked out by the query because the reversal occurs more than
5 min. after the credit sale.
QUERY:
Use WinPayment
GO
SELECT
pos_condition_code,
convert(char(11), retrieval_reference_number) ... more >>
Running multiple months comparitive qry
Posted by J. Joshi at 12/21/2004 12:17:10 PM
Hello all,
I am running a query that compares current months
enrollment with previous months enrollment and generates a
net figure displayed in my report. The way I am currently
doing is manually via 2 temp tables joined by CustID where
I compare the recent month (temp2) with the old/pre... more >>
problem using If condition in select statement
Posted by microsoft at 12/21/2004 12:09:39 PM
Hi!
how can i use if condition in where clause of select statement
I want the work like this
but this is not working correct
select * from Table1
where
if (@a>1)
field1=@a
else
... more >>
problem using If condition in select statement
Posted by microsoft at 12/21/2004 12:07:16 PM
Hi!
how can i use if condition in where clause of select statement
I want the work like this
but this is not working correct
select * from Table1
where
if (@a>1)
field1=@a
else
... more >>
Alter Table for 39 million rows
Posted by Jorge at 12/21/2004 11:55:03 AM
Hi,
I'm trying to alter a table column from tinyint to a smallint, however, the
table contains > 39 million rows and running the alter table takes a long
time. Is there any other way to do the same faster.
I was thinking about creating another column with the new datatype and then
dropping... more >>
After 5 minutes Query
Posted by tarheels4025 at 12/21/2004 11:43:06 AM
Does anybody know why this query isn't pulling credit reversals that occur
longer than 5 min. after a credit sale on a particularly batch number
(corressponds to a particular day). Any insight would be greatly
appreciated. Thanks.
Use WinPayment
GO
SELECT
pos_condition_code,
conv... more >>
Adding Rows with INSERT
Posted by Alexa at 12/21/2004 11:39:01 AM
It might be pretty simple but I am overloaded already. I need insert multiple
rows and have a syntax error. This is a query:
Use db
GO
Insert INTO dTable
()
Values
('1/ 22 / 2004', 'M00', 1, 0, NULL, 1),
('2/ 17 / 2004', 'M01', 1, 0, NULL, 1),
('3/ 17 / 2004', 'M02', 1, 0, NULL, 1),
... more >>
SP for multiple "IF EXISTS (...) UPDATE ... ELSE INSERT ..."?
Posted by Glenn Carr at 12/21/2004 11:38:02 AM
I currently have some batches that insert values if they don't exist, and
update them if they already exist. E.g.,
IF EXISTS(SELECT ...) UPDATE ... ELSE INSERT; IF EXISTS(SELECT ...) UPDATE
.... ELSE INSERT; ...
The batches probably average around 20 statements. I'd like to improve this ... more >>
Transpose query results?
Posted by khalprin at 12/21/2004 11:37:04 AM
Hello,
I'm trying to write a query to retrieve data from one table that is
described by another table. For example:
Table1: Properties - This has a record for each configurable property of an
object.
Id, vcName, vcDesc
Table2: cfgProperties - This has the value for each property that ha... more >>
Query Question
Posted by tarheels4025 at 12/21/2004 10:37:05 AM
Why does this query not return all credit reversals that occur more than 5
after a credit sale in a certain batch (day)
Use WinPayment
GO
SELECT
pos_condition_code,
convert(char(11), retrieval_reference_number) RR,
message_type,
authorization_identification,
conve... more >>
How to append a SP´s result into a TXT File
Posted by Jorge Luzarraga Castro at 12/21/2004 10:33:29 AM
Hi,
is it possible to save the results from a stored procedure execution, which
returns a result set, into a text so that the results are appended. If so,
how could I do it?
I´m trying with this sentence:
ISQL -Uxxx -Pxxx -Q"execute itf_generateinterfase '00001', '20040830',
'2004123... more >>
SQL Server Error
Posted by Sevugan at 12/21/2004 10:21:32 AM
Hai,
When I try to connect SQL Server installed in another machine. I am
getting the following error.
Specified driver could not be loaded due to system error 126. How to resolve
this?
Regards,
Sevugan.C
... more >>
Excel - named ranges
Posted by MS User at 12/21/2004 10:11:35 AM
SQL 2K - DTS
I got a packge to load from Excel sheet to database table. This Excel file
got many sheets and I have to just read from one of the sheet BUT it is
hidden.
Any links or tips for a VB script to create a name range for one of the
sheet.
Thanks
Jeff
... more >>
Problem with sql statement
Posted by Dean g at 12/21/2004 9:49:25 AM
hi all,
i hope i'm in the right place, i'm having problem with what seems like a
pretty simple query..... i need to select the maximum bid from the 'bid
table' that corresponds to an item in the 'item table'. the problem is i
need to select all the details of the particualr winning bid in the bi... more >>
Replace % Value Query
Posted by Richard Wells at 12/21/2004 9:37:07 AM
I'm trying to replace a % symbol within a text string with a *.
Firstly I selected the records using this query.
SELECT * FROM MICAB WHERE CB_DREF LIKE '%[%]%'
Then I ran the update query, this changed the items I wanted but
unfortunately deleted other records that didn't match the query.
... more >>
Follow Up to Date Query Question
Posted by tarheels4025 at 12/21/2004 7:41:03 AM
If I have:
Use WinPayment
GO
SELECT
pos_condition_code,
convert(char(11), retrieval_reference_number) RR,
message_type,
authorization_identification,
convert(char(8), card_acceptor_identification) SN,
convert(char(25), transaction_name) TransactionName,
... more >>
Transaction question
Posted by priyanka at 12/21/2004 7:37:02 AM
Hi All,
There are 2 processes, say A and B, where B uses the values given by A in
the transaction. A updates the value of a field, setting it to 'p' and then
fails without 'Commit'. But B needs the value 'p' for correct end results.
Is there anyway this can be done?
Thanks.... more >>
Long text
Posted by Leila at 12/21/2004 7:21:24 AM
Hi,
I have written a UDF that calls itself and nests its operation. The output
is a varchar value in XML format. But sometimes the XML is more than 8000
characters and varchar is small for that. It is not possible to use text
data type. What can I do?
Any help would be greatly appreciated,
... more >>
change collation of server
Posted by x-rays at 12/21/2004 7:21:04 AM
Hello experts,
Can I change the collation of the server, without rebuild the master db?
Thanks in advance... more >>
how to specify the order of evaluation in the where clause
Posted by David at 12/21/2004 6:47:15 AM
hello!
I have this query....
Select * from myTable where col1='something1' and col2='something2' and
dbo.myfunction(col3) = 1
I want that SQL Server does an evaluation in the same order, so if the first
condition is not evaluated he doesn't evaluate the second.
I need that because the ... more >>
If or case?
Posted by Martin at 12/21/2004 6:25:04 AM
I wonder if any of you can help,if you can many thanks in advance.
rule verification_date future_verification_date test Currency
6 01/11/2004 N
Current
0 02/12/2005 F
Cu... more >>
Query Question
Posted by tarheels4025 at 12/21/2004 6:17:06 AM
I was wondering if someone would know how to write a query I would like to
have done. I am working with credit cards and credit reversals.
Say you have a credit sale at a time written Nov 26 2004 9:32AM
and then a Credit Reversal at a time Nov 26 2004 9:38AM
Is there a way to write a ... more >>
Security Question
Posted by John at 12/21/2004 6:13:07 AM
I have a stored procedure that takes a username and password. When I execute
this procedure, does query analyzer or a ado call in vb encrypt the data
before sending it over the wire? If not, then how do I make sure it is
secure other than using integrated security?
Thanks... more >>
Permissions
Posted by John at 12/21/2004 3:55:04 AM
Ok, here is the situation. I created a stored procedure to call the
xp_cmdshell extended stored procedure. I have been able to run it through
query analyzer on all the accounts I want to. However, there seems to be one
problem. I have specified a unc path where the file is to be placed aft... more >>
adding multiple rows into a table at the same time
Posted by Renjith Chembakarayil at 12/21/2004 3:31:06 AM
I've 3 Tables FIN_PurchaseVoucher(PK-PVGID), FIN_Invoice(PK-InvoiceGID) &
FIN_PVInvoice(PK- PVFID,InvoiceFID)
What i want to do is while inserting a new row in FIN_PurchaseVoucher all
the required FIN_Invoice rows required ie. comma seperated InvoiceGIDs
supplied - 1,2,3,10.. etc. & the Aut... more >>
Reporting Services - Chr(10) Linefeed problem
Posted by mli at 12/21/2004 2:49:03 AM
Since Reporting Services does not support cellmerge between two rows,
I had created one row with column higher than I need, then I put = "ABC" +
Chr(10) + "DEF" on the cell expression. Under the preview section, it is
working fine (It breaks into two lines). However when I deloy the report and... more >>
Check Constraints using a subquery - SSrvr 2000
Posted by L Mehl at 12/21/2004 1:46:45 AM
Hello --
I am new to using contstraints.
I need to add a requirement that the ID for a piece of equipment
included in a quote for a site must exist in the PriceList.
My two tables and their PK columns are
SiteEquipment AS s
-------------
CaseID
RegionID
SiteID
EqTypeID
Pricel... more >>
|