all groups > sql server programming > july 2006 > threads for friday july 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
query ???
Posted by x taol at 7/21/2006 11:53:22 PM
fDate fProduct fClr fIn fOut fStock
03/06/2006 aa xx1 3 2 1
03/08/2006 aa xx1 7 4 4
03/18/2006 aa xx1 6 4 6
03/09/2006 bb xx2 3 2 1
03/11/2006 bb xx2 9 2 8
due : until 03/09/2006
all grouping fProduct,fClr
the answer table is below.
how to make query?
fProduct fClr fStock
aa xx... more >>
SQL Server 2005 throught OLEDB : Named parameter problem ?
Posted by Sylvain Devidal at 7/21/2006 9:05:22 PM
Hello,
I'm designing a web application that must be able to connect different
databases.
So I decided to use OleDb connector instead of SqlClient.
While with SqlClient, I can run queries like "select * from mytable where
col = @param" then giving a value to the parameter, I get an error whe... more >>
add a count column
Posted by Aussie Rules at 7/21/2006 7:16:56 PM
Hi all,
I select two cols from a table, but I want to add another column that is
just a number count.
For example, selecting the top ten selling books returns
Book A, ISBN
Book B, ISBN
Book C, ISBN
etc...
I want to in the my Stored Proc, just add a number that would make the
ret... more >>
datetime index
Posted by Kevin Jackson at 7/21/2006 4:58:10 PM
SQL Server 2005 SP1
I have a table with a datetime column called CreatedOn . CreatedOn is
indexed.
This query uses the index and is lightning fast
select
sum(compressedfilesize) / (1024 * 1024) as 'Repo growth today'
from
dmsrepositorydigitalassets
where
createdon > '20... more >>
Global search and replace in SQL Server with data type ntext
Posted by msnews.microsoft.com at 7/21/2006 4:22:05 PM
Hello,
I want to do a global search and replace in my SQL database where the data
type could also be "ntext". I did find the code which works for (char,
vachar, nchar, nvachar)
Thank you for your help
regards
... more >>
Unknown symbol: #
Posted by KTN at 7/21/2006 3:39:01 PM
I found this in a old stored procedure and wonder if anyone has seen it
before? I check BOL and could not find any explanation. Thanks!
select columnA
from TableABC
where ColumnB = @Val1 and ColumnC = #Breakout.Col1
what is the # symbol means?... more >>
Data warehousing primer?
Posted by Ronald S. Cook at 7/21/2006 2:53:54 PM
I'm looking for a 1-pager that will explain data warehousing simply, and
preferably with examples (so I can prssent to/sell my boss).
I.e...
We have our normal OLTP database with tables like...
Here is a simple star schema and why it's what we do
And then there are OLAP tools in SQL Server 2... more >>
OLE Automation Failure Executing DTS via stored procedure
Posted by Pegasus40218 at 7/21/2006 2:25:06 PM
Our IT group has been running a number of DTS packages via stored
procedures (the sp_OA... procedures) for some time. Recently, we've
started having a lot of problems with the OLE automation procedures
failing. The sp_OACreate procedure seems to work all the time, but the
sp_OAMethod @hPkg, 'L... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Which Version of BOL is Installed?
Posted by Jordan S. at 7/21/2006 1:56:21 PM
SQL Server 2005. How can I discover if a particular computer has BOL SP1
installed (vs if SP1 for BOL is not installed)?
Thanks.
... more >>
Combining 2 select statements
Posted by randy1200 at 7/21/2006 1:20:02 PM
I have two select statements. The only different between them is in the where
clause. Instead of returning "Community, Monthly Total" and "Community, YTD",
I'd really like one statement to return "Community, Monthly Total, YTD".
Any suggestions?
Thanks,
Randy
select cr.ecity as 'Commun... more >>
Tuning
Posted by markrr NO[at]SPAM comcast.net at 7/21/2006 12:50:13 PM
(I had posted this in another group that I realized is probably not the
right one).
I have a fairly complex SELECT statement. It is running on a server
with 8 CPUs and 8GB RAM (using about 6.5GB). The statistics that I get
when I run it are below. It is not the first time that I ran it so t... more >>
Log not shrinking
Posted by Scott at 7/21/2006 12:25:26 PM
I have an offline database that gets occasional updates maybe once or
twice a week. The attached script runs every night and each morning I
check it for successful completion. Today the log showed a size of 12
gig (All my other logs after shrinking are around 1 meg). This is
after successful ... more >>
significance of COLLATE
Posted by steve02a NO[at]SPAM gmail.com at 7/21/2006 11:56:10 AM
What is the significance of COLLATE in a database script file?
I have db script I use for a piece of software I've created - and I
have (and understand its meaning:
COLLATE SQL_Latin1_General_CP1_CI_AS
My DB works with or without that statement - so I'm trying to figure
out the significan... more >>
Only text pointers are allowed in work tables. never ... image col
Posted by chieko at 7/21/2006 11:55:02 AM
Hello,
I am using an insert statement in a stored procedure that insert and image
datatype column into a table on a different sql server, same edition server
2000.
It was working a few days ago in a job, but I had to stop the server to
defragment the drive. Now the stored procedure produces ... more >>
Changing resultset to 1 row and 1 column
Posted by MittyKom at 7/21/2006 11:50:01 AM
Hi All
How can i change the resultset of a query from being a column and several
rows to just 1 column and 1 row? eg
select * from tb1
The resultset is as below:
Col1
------
ab
ac
ad
I would like it to come as below (that is as 1 column and 1 row):
Col1
------------
ab, ac, a... more >>
Stored Procedure Lock?
Posted by Lionstone at 7/21/2006 11:32:47 AM
Is there a way to keep a stored procedure from executing more than once
simultaneously? That is, if three commands to execute the procedure arrive
nearly simultaneously on different connections, how can I make the requests
queue up so that the procedure executes one at a time with no overlap,... more >>
Ingnorant about encryption with symmetric key and certificates
Posted by Dave at 7/21/2006 11:32:01 AM
I created a master key in my database...
create master key encryption by password = 'pw';
Then I created a certificate...
create certificate my_cert
with subject = 'encrypt cc numbers';
Then I created symmetric key...
create symmetric key my_sk
with algorithm = aes_19... more >>
Tuning
Posted by MarkR at 7/21/2006 11:31:02 AM
I have a fairly complex SELECT statement. It is running on a server with 8
CPUs and 8GB RAM (using about 6.5GB). The statistics that I get when I run
it are below. It is not the first time that I ran it so the execution plan
already exists and it looks like the data is all in RAM which is ... more >>
Developer Edition / Reporting Services
Posted by Brian Shannon at 7/21/2006 11:21:40 AM
I installed SQL server 2005 Developer edition on an XP box. The Reporting
Services option was grayed out so I was unable to install that module.
Is that normal?
Thanks.
... more >>
DateTime Formatting Question
Posted by Tom Andrecht at 7/21/2006 11:11:27 AM
I have a datetime field that I'm storing entries for activities in, but I
need to retrieve the dates and times seperately (no problem there, Convert()
saves the day for seperating them), but I need the Time in a 12 hour format
instead of the 24 hour that SQL Server returns. Is there a way to ... more >>
sql query testing
Posted by sakcee NO[at]SPAM gmail.com at 7/21/2006 10:43:07 AM
Hi
I need to make test plans for some sql select queries, what conditions
or things I should test?
I was thinking of testing where clause for data types etc?
any help is greatly appreciated
thanks
... more >>
Slow update on SQL Virtual Server 2000 on WIN2003 cluster
Posted by ikaliy at 7/21/2006 10:18:09 AM
Hello,
I have noticed the difference in transaction handling between SQL
Server 2000 EE installed on local WinXP machine
and SQL Virtual server on WIN 2003 failover cluster.
And this difference put me in big trouble.
For example:
If you need to update 100000 record (update of one integer f... more >>
Case statement question
Posted by Goran Djuranovic at 7/21/2006 10:03:22 AM
Hi All,
Is it possible to update a specific field based on the case statement?
Something like this, for example:
UPDATE Person SET
CASE
WHEN HB =3D '1' THEN HasBrother =3D '1'
WHEN HS =3D '1' THEN HasSister =3D '1'
END
FROM <Some other table>
......
I know one way is to speci... more >>
Need help with windows service being "database aware"
Posted by rhaazy at 7/21/2006 9:46:07 AM
My situation is this.
using mssql 2000:
I have a series of tables. Each table is designated for a particular
"profile"
There are lets say 4 profile tables. Each table has a list of assets
in them. Then the information pertaining to that particular profile
for that particular asset.
The... more >>
Help wit a complicated query
Posted by BK-Chicago at 7/21/2006 9:27:02 AM
I have a dataaset like the one below:
Qualifier Date Whole/Partial Partial Count
A 1/12/2000 W NULL
A 1/3/2001 P 1
A 1/6/2001 P 2
A 1/9/2001 P 3
A 1/12/2001 P 4
B 1/4/2001 W NULL
B 1/7/2001 P 1
B 1/10/2001 P 2
B 1/1/2002 P 3
B 1/1/2006 P 4
B 1/4/2002 P 4
There are more than a mil... more >>
SSIS Package through SQL Agent Jobs
Posted by John at 7/21/2006 9:26:02 AM
I am having trouble running SSIS packages through SQL Agent Jobs. The error
I get is that the command line is invalid. The command line is automatically
generated by sql server not by me. I can manually execute the package
through SSIS, but not through an SQL Agent Job. I even tried coping... more >>
Interesting Fundamental Questions about Tables
Posted by Rajesh at 7/21/2006 9:02:01 AM
Good Morning Sql Gurus
Please give me some inputs on the following issues.
create table x
(
col1 int not null,
col2 int null
)
alter table x add constraint xpk primary key (col1)
create index xsk on x(col2)
drop table y
create table Y
(
col1 int not null,
col2 int null
)
... more >>
grouping problem
Posted by Phill at 7/21/2006 8:51:02 AM
I am trying to return a result set in a cross-tab format. My problem is that
my date field has the time, thus returning more than one record for date
instead of summing it. How can I fix this? This is my query:
SELECT dbo.tblDrivers.First_Name + ' ' + dbo.tblDrivers.Last_Name AS Driver,
... more >>
Database/ Table Property
Posted by aacftc at 7/21/2006 7:57:02 AM
I have an applictaion where when I update/ insert any record in child tables,
it calls update statement for parent table (poorly designed) so I want to
know if there is any database/ table property which I can set to check run
commit only in case update statement is really making changes to th... more >>
Question on QUOTED_IDENTIFIER
Posted by John at 7/21/2006 7:43:17 AM
I have a very strange problem, it only happen to one SQL Server, other
SQL Server seems to be fine
I got the following error when trying to run a sp against one of the
SQL Server:
SELECT failed because the following SET options have incorrect
settings: 'QUOTED_IDENTIFIER'. Verify that SET ... more >>
Is there a function can convert a comma delimited string to int se
Posted by NeilB at 7/21/2006 7:27:01 AM
This might be a stupid question, i got a string "20,30,40", I want to use the
string in the following SQL stmt:
@user_id_list VARCHAR(400)
....
-- now @user_id_list is "20,30,40"
....
SELECT user_id from user_table where user_id IN (
a_magic_function(@user_id_list) )
Is there such a ... more >>
Any function in SQL Server similar to decode function in oracle ?
Posted by Amit20 at 7/21/2006 5:26:02 AM
Hi,
Is there any function in SQL Server similar to decode function in oracle ?
Thanks,
Amit... more >>
MS SQL - how to change header in mail
Posted by Chris at 7/21/2006 4:19:11 AM
hi,
I have ms sql server 2000. I need to send automatic emails from it. I am using:
exec sp_OACreate 'CDO.Message', @iMsg OUT;
---- so on---
the properties of the object are set up by:
sp_OASetProperty @iMsg, 'To', @variable -- that is an example
buy I really need to modify the mail header.... more >>
vb and c# in single project?
Posted by NH at 7/21/2006 3:11:02 AM
I am pretty sure this is possible in .Net 2.0...?
I will build a web service in vb which will also include calling object
written in c#. This will work wont it?... more >>
strong performance problem with a parameterized query
Posted by Silvere at 7/21/2006 1:49:02 AM
We have a strong performance problem with a quite complex query.
The query executes in approximately 7 seconds in Query Analyser (which is
okay for us), but takes much more time from ADO.NET : it timesout after 30
sec, or after 240 sec if we increase the timeout to that value.
The ADO query ... more >>
Applying a function to a subquery
Posted by Steve at 7/21/2006 1:17:27 AM
Hi there,
I have a function that splits data into intervals based on their
timestamp as follows:
ALTER FUNCTION intervals(@begin DATETIME, @end DATETIME,
@lengthInSeconds INT)
RETURNS @intervals TABLE(interval INT PRIMARY KEY, interval_begin
DATETIME, interval_end DATETIME)
AS
BEGIN
D... more >>
how to set null value from vb to sql server
Posted by vincentstudy at 7/21/2006 12:47:12 AM
hi to all,
i am using sql 2000 server now i want to set null value
to my table from visual basic code. i am try to some update query shown
below.
my table name
rs.open "update student set newid = null where sname='raja'"
rs.open "update student set newid = 'null' where sn... more >>
Execution plan vs real life
Posted by Ole Kristian BangÄs at 7/21/2006 12:29:01 AM
I hope the code sample below is well enough formatted and easy enough to
read. In short:
1. Creating a table of 250k random data in tempdb
2. Run a batch of two statements, with actual exectuion plan on.
Execution plan tell these queries have the same cost, or very
close to.
3. Run a ... more >>
column dataType
Posted by simonZ at 7/21/2006 12:00:00 AM
I have function, which returns the dataType of some column in some table:
declare @columnType nVarchar(50)
set @columnType=dbo.colType('myTable','myColumn')
It works, the result is for example 'varchar(50)'.
Now, I would like to declare variable of this column type.
What is the best way... more >>
Query from a dynamic table
Posted by Steven at 7/21/2006 12:00:00 AM
Hi All,
I want to have a SQL statement which query from a dynamic table inside a
store procedure. However, I have no idea on how to get it done.
For examples:
DECLARE @TABLE AS VARCHAR(10)
SELECT @TABLE = 'MyTable'
SELECT * FROM @TABLE
However, an error message appears "Must declare th... more >>
Stored Procedure can not work perfectly for Big5 characters issue
Posted by Joseph at 7/21/2006 12:00:00 AM
Hi, all
I have a question :
I created a stored procedure with 1 string type parameter [input],
it can work perfectly when I use an input string with Big5 characters if I
execute the stored procedure from SQL Query Analyzer tool, but when I call
this stored procedure in VC++ ,it ca... more >>
SQL Server returning hierarchical records
Posted by archon at 7/21/2006 12:00:00 AM
does SQL Server 2005 have something similar to Oracle's START WITH CONNECT
BY sql syntax, for returning hierarchical records?
... more >>
insert multiple row copies for lookup without cursor
Posted by adam at 7/21/2006 12:00:00 AM
I'm after some help with an insert that uses a select cursor that
probably should not.
The schema if for an existing application and cannot be altered. I do
not have access to the source for this application
[Table: Forms]
FormId (int identity) Name (varchar)
1 Apple
2 Banana
3 Cherry
... more >>
++ IIS + SQL (Not enough storage is available to complete this operation)
Posted by tolgay at 7/21/2006 12:00:00 AM
Sometimes we got an error (Not enough storage is available to complete
this
operation) from one of our servers which on win2000 sp 4 iis5.0 (all
hotfix
installed) sql server sp4. mdac 2.81. It occures random and we could not
find the error reason. When the error occured the server cpu or m... more >>
How to change binary data in buffer to string format
Posted by Anderson at 7/21/2006 12:00:00 AM
Dear all,
Could anyone tell me how to convert binary data in buffer to string
format,thanks in advance!
Anderson
... more >>
|