all groups > sql server programming > january 2006 > threads for wednesday january 11
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
convert hex string to hex literal
Posted by JTL at 1/11/2006 9:56:38 PM
how can i tell sql server to execute the "convert" function using the
literal hex value, 0xC0, rather than the string value '0xC0'?
for example, this works:
declare @myhexint as int
set @myhexint = 0xC0
select convert(int, @myhexint)
but this does not:
declare @myvarchar as varchar(20)
... more >>
create a temporary table
Posted by Frank Dulk at 1/11/2006 9:45:05 PM
How to create a temporary table where the name of the table is the user's
ID.
#@IDUsuario
... more >>
SQL Server vs the Competition
Posted by Jeff at 1/11/2006 9:03:39 PM
I'm looking for some brief summaries or comparisons that support an IT
management decision to implement a new system with SQL Server as the
database and not an alternative db (oracle, informix, whatever).
Specifically looking for things like return on investment (ROI) and total
cost of owner... more >>
MS DTS Object Package Library
Posted by Joe Delphi at 1/11/2006 8:24:35 PM
Hi,
I am trying to execute an MS SQL Server DTS package from my Microsoft
Access form. Here is the code I am using:
Private Sub cmdImportScats_Click()
Dim pkg As DTS.Package
Set pkg = New DTS.Package
pkg.LoadFromSQLServer "NTOMT76SQL,7115", "", "", DTSSQLStgFlag_Default, "",
"",... more >>
Filter on view Problems
Posted by Oded Dror at 1/11/2006 6:57:17 PM
Hi there,
This is a view base on Northwind database
SELECT dbo.Orders.CustomerID,
dbo.[Order Details].UnitPrice AS NewUP,
dbo.[Order Details].UnitPrice
FROM dbo.Orders INNER JOIN
dbo.[Order Details]
... more >>
select * from inserted
Posted by Desmond at 1/11/2006 5:48:02 PM
Hi,
In trigger, there's this sql statement, select * from inserted & select *
from deleted. May I know what're their purposes ?
Any links for additional info ?
Thanks !... more >>
Stored Procedure Error - Newbie
Posted by Anthony D. Law at 1/11/2006 5:13:03 PM
I am trying to create the following SP:
*****************
CREATE PROCEDURE [dbo].[SUBJECT_Update_Properties]
(
@PROJ_KEY varchar(4),
@CDKey varchar(10),
@UIKey varchar(8),
@ProjectName varchar(50),
@Builder varchar(50),
@CommunityName varchar(50),
@MasterPlan varchar(50),
... more >>
How to convert a Base 64 string to an image
Posted by Paul Robinson at 1/11/2006 4:18:12 PM
Hi,
I have a stored procedure which takes a base 64 string as an input
parameter.
Can anyone tell me how to decode the base 64 string using sql so I can store
the data as a SQLServer2000 image data type?
Thanks,
Paul
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
SQL Statement guru required please!
Posted by Matt Jensen at 1/11/2006 4:03:08 PM
Howdy
I've got no idea how to do what I want to do.
Directly below is my main SQL statement which is fine, but which I want to
add a count to (as per text in square brackets).
SELECT tbl_Users.UserID, tbl_Users.Firstname, tbl_Users.Surname, 1 AS
LeadWorker, [INSERT COUNT HERE]
FROM tbl... more >>
Select Records Bases On Total Needed
Posted by Brian at 1/11/2006 3:39:47 PM
I have a query which has to return a specific number of records per region.
Example
Region Region ID
Percent Total
California 50 15% 3,750
Midatlantic 35 9% 2,250
Central 24 9... more >>
reverse order of hex bytes
Posted by JTL at 1/11/2006 3:27:28 PM
is there a function in sql server to select the REVERSE order of a 32bit hex
value?
then i also need to convert each byte to a decimal number.
any help is much appreciated..
tia,
jt
... more >>
Select Records which are not present in second table
Posted by pmud at 1/11/2006 3:00:02 PM
Hi,
I need to select only those rows from Activations table which are not
present in the Logs table. I used the Left outer join but it returned all
records from the left table. Below is the query I used:
SELECT MobileID from ACtivations
LEFT OUTER JOIN Logs on ACtivations.MobileID=Logs... more >>
SQL Agent Mail and Outlook
Posted by Andre at 1/11/2006 2:51:02 PM
Can someone point me to some articles on why Outlook needs to be installed on
the SQL Server in order to configure SQL Agent Mail to send notifications?
Also, is there any other ways of sending alerts and stuff through Agent Mail
without having to install Outlook?
Thanks all.... more >>
View Parameter problems?
Posted by Ed Dror at 1/11/2006 2:46:32 PM
Hi there,
I created a view look like this
select amount from table and I added condition as another column look like
this
(SELECT amount As "newAmt" from vPivotT where Flag "=" 'X' And tr_staus "="
'A' And Acct "<>" '1410')ct "<>" '1410') As "NewAmt"
But I'm getting an error can't p... more >>
Retreiving multiple Output Parameters
Posted by jonefer at 1/11/2006 2:29:04 PM
Could someone help me update a working stored procedure to output 3 parameter?
I'd like to retrieve 3 parameters from a stored procedure based on a sample
written by Erland Sommarskog
My stored procedure thus far accepts 5 INPUT parameters
MRN, MemNAME, DOB, SEX, SSN
the fields that I ... more >>
Why doesnt this query work in SQL Server 2000, but does in 2005?
Posted by Brian Henry at 1/11/2006 2:06:03 PM
Here is the query and error message...
The following error message was returned from the SQL Server:
[107] The column prefix 'PremiumRateSetsJunComponents' does not match with a
table name or alias name used in the query.
The column prefix 'PremiumRateSetsJunComponents' does not match with ... more >>
Best approach?
Posted by Shawn Ferguson at 1/11/2006 1:57:25 PM
I have a problem. My website hosting company can only host sql server =
database that are less than 100 mb. Usually that is not a problem for =
most of my applications, however I have one client who has a database with =
over 270000 records which makes the database over 100MB. What can I do? ... more >>
PIVOT Query Question - SQL 2005
Posted by John . at 1/11/2006 1:32:49 PM
I am trying to create a crosstab query using SQL 2005 and the PIVOT
operator using the following data:
Id MetricId Metric BaseVal PeerVal
012141 1 MarketValueChange 0.08 0.46
012141 2 BarraPredictedBeta NULL 1.44
012141 3 Beta ... more >>
Date Only Data Type
Posted by Primera at 1/11/2006 1:31:58 PM
I would like to have a field in a table that is a Date only data type instead
of the datetime. Could someone offer any advice on this in SQL Server 2005.
Thanks
... more >>
Update
Posted by Mathew at 1/11/2006 1:13:03 PM
Hello,
I have to add a column to my table that is suppose to be like a serial
number. As my table has 1500 records and i don't want to delete them or add
an incremental field, i would like to write an update SQL Scripts, but i
don't know how to write it to put the record number (row number)... more >>
good db diagramming tool?
Posted by Dr Van Nostrand at 1/11/2006 12:55:06 PM
Looking for a recommendation on a good db diagramming tool.
TIA
... more >>
Adding time
Posted by asrs63 at 1/11/2006 12:53:53 PM
Hi,
I have a table with process_id and process_started_at and
process_completed_at which are both datetime datatype.
I need to calculate the total time taken for a particular process for a
given date-range.
and calculate average time per day per process_id.
How can I do it I have MS SQL... more >>
Max record
Posted by Jaco at 1/11/2006 12:39:03 PM
Hi
How can I select the last record from all my tables in a database based on a
specisic date?
All my tables has timestamp columns.... more >>
Time Calculation - NEED HELP PLEASE!
Posted by Joey at 1/11/2006 12:12:02 PM
I have a SQL Server 2005 database with fields:
start_time (smalldatetime) has value of: 1/4/2006 10:15:00 AM
stop_time (smalldatetime) has value of: 1/4/2006 2:30:00 PM
We need the TIME only -- not the date portion of the field.
I want to use a SQL Select statement in VB 6.0 to calcula... more >>
top x by hour for some time
Posted by brw NO[at]SPAM fuse.net at 1/11/2006 12:06:49 PM
I am trying to write a query that gives me the top X [users], by hour,
for a particular day. so, by order of hours, for example, I want to see
the top 3 for 12am, top 3 for 1am, 2am, etc. all in one result set.
My first thought was to, within a while loop, add 'where hour = xx' to
the clause, ... more >>
SQL and informix
Posted by Jack at 1/11/2006 11:35:20 AM
I'm making a report in Reporting services while getting data via odbc from
an Informix database
Somehow I can do this in SQL query analyzer with the linked informix server
if 2 > 1 begin
select * from Informix.economi.root.lande
end
But if I do this in reporting services with a odbc so... more >>
convert UTC date
Posted by JTL at 1/11/2006 11:24:46 AM
hi- i'm working with a database that stores dates in UTC format. does
anyone know of, or have, a function to convert from this format?
tia,
jt
... more >>
TEXTIMAGE
Posted by Cowboy (Gregory A. Beamer) - MVP at 1/11/2006 11:11:03 AM
Have a table with a TEXTIMAGE specified. The text column was dropped, but the
TEXTIMAGE does not drop automatically with ALTER. This is not a major issue
with the current database, but forces having to edit this out on every script
that includes this table.
Is there a way to drop TEXTIMAGE ... more >>
Array?
Posted by meverts at 1/11/2006 11:05:02 AM
I have a query where I pull data based on a min function the gives me the
newest order. However when I pull the data I will get four records as I need
to pull all the data for this order. What I need to know is how do I take
the data that I need assign a variable to it and only return one re... more >>
2005 SP1
Posted by SQL at 1/11/2006 10:44:35 AM
The TPC site has a result in review (hp Integrity Superdome )
configured with sp1
Does anyone know if this will be available soon?
http://tpc.org/tpcc/results/tpcc_result_detail.asp?id=105112801
http://sqlservercode.blogspot.com/
... more >>
DTS Package
Posted by Patrice at 1/11/2006 10:22:06 AM
Hi -
I'm wondering if there is a way to have an "Execute Packge Task" run even if
the package that triggers it has multiple tasks running simultaneously? So I
don't want the next package to run until the current package is finished, but
there is not a definite start and end point to the ta... more >>
help
Posted by peter at 1/11/2006 10:22:04 AM
I am runnig query select count(*) from A
I like to display the count in following format. For ex.
If the count is 45 then it should display 000045
If the count is 145 then it should display 000145
If the count is 5 then it should display 000005
If the count is 0 then it should display 00000... more >>
copy from C drive of sql server to another sever!
Posted by CharlesA at 1/11/2006 10:02:38 AM
help!
I'm using a SQL server 2000 box and I'm a member of sysadmins on it and I
have a remote drive mounted on the server that I can copy files to with
Explorer and the command line.
I've created a job that has the following line of SQL in it
xpcmdShell 'copy "C:\Program Files\Microsoft SQL... more >>
Function update
Posted by sid.discuss NO[at]SPAM gmail.com at 1/11/2006 10:02:07 AM
A gentleman from here helped me to write a function to convert oracle
date to a MS Sql date.
Here is the link
http://groups.google.com/group/microsoft.public.sqlserver.programming/browse_frm/thread/874dc9e1d4c06e12/ac366d00a8ebc33c?lnk=st&q=dbo.to_date&rnum=1&hl=en&utoken=dgGivEkAAACAT_kPml7nPa... more >>
UniqueIdentifier, performance of Nonclustered indexes
Posted by S at 1/11/2006 10:02:07 AM
Table A has a PK, 2 Non clustered indexes already. Recently a new column
Uniqueidentifier is added to this table and a highly transactional SP is
modified to use this new GUID column as the driving factor to look for rows.
This column is not indexed (uses index scans now) and performance is go... more >>
10 seconds for MoveFirst on a rowset?
Posted by Roger Garrett at 1/11/2006 10:02:04 AM
I'm doing a query on a database that has 250,000 records. The query is
returning a rowset with just 12 records in it. When I do the MoverFirst() on
the rowset it takes 10 seconds to accomplish. And when I do subsequent calls
to MoveNext() on the rowset it takes anywhere from 2 to 12 seconds to... more >>
SQL SERVER Set Up
Posted by mvp at 1/11/2006 10:00:04 AM
Hello,
We are implementing clustering (Active/Passive) in our Production environment.
So we will have two windows server 2003 for SQL SERVER. (ProdDbServer1 and
ProdDbServer2)
I will install SQL Server on both the machine and i will create my database
(FinDB)
on both the machine's SQL SERVER... more >>
Giving a total on a column value change
Posted by g3000 at 1/11/2006 9:52:51 AM
I have the following data in a table
date StartTm ElapseTm shift Job# Op#
WorkCtr Qty1 Qty2
20051218 0030 0030 13 165990 225 9 .0000 0
20051218 0100 0030 13 165990 223 9 .0000 0
20051218 0130 0145 13 165... more >>
Two DB Update
Posted by Darren Woodbrey at 1/11/2006 9:28:02 AM
I have 2 databases, say db1 and db2. In db1 I have a table tbl1 and in db2 i
have a table with the same structure but different data. (db2 is a copy of
db1). The structure is as follows:
db1
customer totalytd totallyr
db2
customer totalytd totallyr
The customer fields have the same da... more >>
SQL Thread-safe ?
Posted by Roger Garrett at 1/11/2006 9:18:04 AM
It is my understanding that SQL Server 2000 is "thread-safe". Am I correct in
concluding that I therefor do not need to use EnterCriticalSection() and
LeaveCriticalSection() when performing queries on my database?... more >>
Bug with GROUPING keyword?
Posted by Matt Hooper at 1/11/2006 8:46:55 AM
Hello World,
I have an aggregated query (A) that works fine that uses inner joins.
As soon as the joins are changed to left joins (query B) the following
error occurs:
The grouping aggregate operation cannot take a uniqueidentifier data
type as an argument.
This makes sense b/c a uniqu... more >>
RESTORE just a table from backup
Posted by RSH at 1/11/2006 8:43:52 AM
Is it possible to restore just a table from a database backup? If so what
does the T-SQL look like to perform the event?
I couldn't find any resources specifically on how to do this.
Thanks,
Ron
... more >>
13-Month Rolling Average
Posted by Stephen Sanders at 1/11/2006 8:36:16 AM
I am looking for assistance in writing a query that will display a 13-month
rolling average based on the current date. My table looks like this:
DATE PROGRAM REVENUE
12/31/2004 Department A $150
1/31/2005 Department A $100
....
12/31/2005 Department A... more >>
Help with SELECT
Posted by George at 1/11/2006 8:02:10 AM
Hi all,
I have the following tables: Member, Dependent, Doctor.
I am trying to get, based on the name entered, all members and dependents
that have seen a certain doctor.
For example, I supply the last name SMITH and the docotor ID 1234567890. I
need to get all of the members with the... more >>
temp store ids to delete later
Posted by Mark in Miami at 1/11/2006 7:56:03 AM
I need to delete a set of IDs (unknown before the delete). I then need to
immediately turn around and delete all correspoding FK table record that
belong to the IDs I just deleted. Seems like there's a collection or array I
would build during the delete then traverse it to deleted the detail... more >>
Returning indexed data with stored procedure
Posted by nottheface NO[at]SPAM gmail.com at 1/11/2006 7:53:37 AM
I have created a little store procedure that goes as shown below. This
may not be graceful but it works, and this isn't the problem. The
problem is (and I will be cross posting this) that when I try to link
this stored proc into Crystal 8.5, I get a "Invalid file link. Field
is not indexed" ... more >>
Format date output
Posted by Deki at 1/11/2006 7:51:06 AM
Hello,
I have a query that looks something like this:
select LEFT(dbo.Charges.service_date + SPACE(10), 10) AS ImmunizationDate
from dbo.charges
I need output to be in mm/dd/yyyy format without changing users date/time
settings. Service_date is of datetime data type.
--
Deki PA
... more >>
Display data according to dates
Posted by .Net Sports at 1/11/2006 7:38:39 AM
Right now, i have a T-Sql statement that grabs the latest dated article
from my db to display in a blog like manner, but what I really need to
do is not display the latest article until after 12 midnight server
time. If the author submits an article for 2006/1/12, it will appear
immediately if h... more >>
Execute Package Task
Posted by Patrice at 1/11/2006 7:26:03 AM
Hi,
I have a DTS package that runs numerous tasks simultaneously for time and
performance reasons, but I would like to add an "Execute Package Task" to
this package so that another package will run, but only after all tasks have
finished in this package. Is there a way to do this?
Thank... more >>
EXISTS or other construct to achieve FK table record deletion
Posted by Mark in Miami at 1/11/2006 7:26:02 AM
I need one other favor. I am trying to delete the detail records from the
detail table before deleting the header record from the pk table. I have put
together the following SQL. The SELECT statement gets the 2 records I need
from the detail table, but I'm not sure how to pass the ID's to t... more >>
Help! Problem with DateTime.Now and SQLServer 2005
Posted by BetaD at 1/11/2006 6:20:13 AM
I am in the proces of upgrading from access to SQL Server 2005, and I
am having a strange problem. When I set the value a column in a data
row to DateTime.Now and save it to the server the date is two days in
the future! This happens for both typed and untyped datasets.
ex DataTable dt=new D... more >>
Set defalut value to previous collumn with changes?
Posted by bernadou at 1/11/2006 5:44:01 AM
I have 'intermediate' MSAccess development knowlege and I'm trying to apply
that knowlege to SQL2005. Obviously is it vastly more powerfull (and
complicated) so I'm struggling with a few things (at the moment...).
Is there a simple way, using SQL2005 to set the default value of a column
eq... more >>
SQL server programming tutorial
Posted by Shekhar Gupta at 1/11/2006 5:15:03 AM
Hi,
I am new to SQL server. Can someone please suggest any FREE online tutorial
/ book which is really helpful for a beginner. I want one which starts from
basics and goes to advanced level including T-SQL, OLAP and all.
SQL server's books online section is not at all helpful.
Please he... more >>
add cariage return
Posted by shank at 1/11/2006 5:15:01 AM
I'm trying to add a carriage return in the below function, but nothing is
happening.
The end result is to cut-n-paste into notepad with carriage returns.
What am I doing wrong?
thanks!
CREATE FUNCTION dbo.fctConcatTitles
(
@O VARCHAR(32)
)
RETURNS VARCHAR(8000)
AS
BEGIN
DECLAR... more >>
Normalization Question....
Posted by Pete Wittig at 1/11/2006 2:03:02 AM
Hi,
I have a table of entities. Each of which has a unique ID. For a certain
subset of those entities, a particular set of values can apply to a pair of
entities.
Let's call the entity ID's E1 and E2 and the associated values x, y and z.
E1 and E2 are GUID's and x, y and z are floats.... more >>
SqlDependency and Updates
Posted by Florian at 1/11/2006 1:46:02 AM
Hello,
I've got a little trouble because updates seem to trigger SqlDependencies
even if the update is already finished.
I'm watching data with an SqlDependency which I eventually update myself.
When I update the data I do it like this:
- Release current SqlDependency
- Update Data
- ... more >>
convert datetime if... then... else...
Posted by Hans - DiaGraphIT - at 1/11/2006 1:16:03 AM
Hi!
Apreciates any help.
I have a 9 digit nvarchar identification where i'm using following code
ddmmyy123. I wish to exctract the ddmmyy to a datetime BirthDate. The
problem is if someone is born 14. march 1905 the code shows 140305. When
converting the nvarchar to datetime it shows 1... more >>
|