all groups > sql server programming > april 2007 > threads for wednesday april 25
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
Running Total for sales by week
Posted by aj70000 NO[at]SPAM hotmail.com at 4/25/2007 11:11:08 PM
Hi,
Here's what I need as the output for running total
Week BU Cumulative_Amount
1 AB 100
2 AC 230
3 AB 120
4 AB 0
5 AB 120
I would like to fill in the value of week 4 to 120 usin... more >>
Resume in an SP with Error Handling
Posted by Mickey Red at 4/25/2007 10:35:41 PM
Hi
Is it possible to use a command like resume next or similar in an error
handlin routine. My problem is:
I habe an SP that consist in four steps. Each step deletes first all
records in a table an insert new records in this table. If an error
occurs an rollback is issued and the next st... more >>
run time error 8000054005
Posted by Dave at 4/25/2007 10:20:18 PM
I am connecting from an Access front end to a SQL Server 2005 Express
database on a remote PC. I have enabled TCP/IP on the server and
turned off firewalls on both boxes.
The first recrodset opens and reads the data fine. The subsequent one
(which runs after it gives the following error on up... more >>
SQL2005: Stored Procedure parameters of Table type?
Posted by pedestrian at 4/25/2007 7:21:16 PM
I'm using SQL Server 2005 Express. I would like to create a
stored procedure with parameters of Table type... My purpose
is to move records from a source table to a target table.
so I write:
CREATE PROCEDURE theProc
@SourceTable TABLE, @TargetTable TABLE
AS
...
However, this didn't wor... more >>
help passing param's to stored procedure for .adp form
Posted by webgirl at 4/25/2007 6:57:52 PM
Hi all,
I have a form in an Access project that uses a parameterised stored
procedure for its RecordSource ("EXEC sp_GetJobsSummary")
I'm trying to change the order of the form by passing a parameter to
the stored proc... and tearing my hair out. I've read many articles
& suggestions over... more >>
best way to change tinyint to int in entire database?
Posted by Les Caudle at 4/25/2007 6:20:34 PM
I've inherited a SQL 2000 database that uses tinyints all over the place.
It will now run on SQL 2005.
The problem comes where he's setup a tinyint primary key referenced by int
foreign keys, and vica versa. Lots of these. Lots.
Obviously, I can't set up any relations between ints and ... more >>
difficult select statement
Posted by justin at 4/25/2007 6:00:59 PM
Hello, I am having a problem creating a somewhat complicated select
statement. I have written lots of stored procedures before, but only
very simple ones. Here's what I want to do.
I have a table covering types of services, right now there are about
10 but more could be added. So this table "S... more >>
convert julian date to regular date
Posted by isabelle at 4/25/2007 4:26:01 PM
Hi,
I have a column that is being called a julian date format although is not
"true" julian date and I need to convert them to regular date YYMMDD. An
example would be 6339 which is referring to Dec 7, 2006. In Oracle, I would
use:
to_char(to_date(julian_col,'YDDD'),'YYMMDD') as REGULA... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Parse delimited column
Posted by ryan.carver NO[at]SPAM gmail.com at 4/25/2007 3:36:28 PM
What is the most efficient way to parse a column in a table that looks
like the following:
7858.95;10014.06;8515.87;6804.25;0;0;0;0;0;0;0;0
12800;11000;7400;5180;0;0;0;0;0;0;0;0
0;0;0;0;0;0;0;0;0;0;0;0
There will always be 12 different values in the string.
I would like each value to be ... more >>
Return XML from database table
Posted by mvp at 4/25/2007 2:38:03 PM
I want to return xml data from the database table. Sample xml is as below.
I want to return xml exactly which i have mentioned in the sample xml below.
Pls let me know, How can I achieve in the sql server 2005.
<?xml version="1.0" encoding="UTF-8"?>
<ROWSET xmlns:xsi="http://www.w3.org/2001/XM... more >>
Cumulative Total By Week
Posted by aj70000 NO[at]SPAM hotmail.com at 4/25/2007 2:36:26 PM
Hi,
I have a unique situation for getting Cumulative billings_by_week.
I am running SQL 2005 on windows 2003 server.
Here's the situation.
I am running this query to get Running_Total
SELECT Week, BU,(SELECT sum(Cumulative_Billing) AS Expr1
FROM ... more >>
add .Net Framework 2.0 to sql server
Posted by Claudia at 4/25/2007 2:24:03 PM
I need to install Idera's SQLsafe 4.0 onto clustered production sql
servers(sql2005 enterprise, 64-bit; Window 2003 enterprise), which requires
..NET Framework 2.0 as prerequisite. I am wondering if it will cause any issue
with multiple versions of .NET Framework on the same sql server. Has an... more >>
monitor space
Posted by FARRUKH at 4/25/2007 1:46:02 PM
I am working as a DBA in FORD manufacturing plant. its a 24/7 production
database and running 30 database (SQL Server 2005, 2000) servers. Management
want to see bi-weekly database storage report and which database is growing
fast.
is there any scripts in SQL 2000 and 2005 to give storage r... more >>
Randomizer within a Stored Proc
Posted by MSUTech at 4/25/2007 1:06:01 PM
Hello All,
What is the best way to generate a random integer between 1 and 12 ... that
will allow me to select a random record from within a table?
thanks..... more >>
List of relationships within a db (sp?)
Posted by mgm at 4/25/2007 12:58:34 PM
Is there a stored procedure, query, or something that can show a databases
table relationships in a result set?
For instance results like this:
TableName PK FK FKTable
Thanks!
mgm
... more >>
Modifying date value (varchar)
Posted by Rob at 4/25/2007 12:52:02 PM
Hi,
I receive a flat file that contains, among other info, a value for date.
This value is 10 char. long and a sample of what it could look like is
(CCYY-MM-DD):
2007-4-12
2006-12-31
2007-4-1
2006-12-5
As you can see, the MM & DD values do not contain a leading zero for sigle
d... more >>
Graphically creating Transact SQL Statements
Posted by Declan at 4/25/2007 12:48:04 PM
1.) I was able to get a table from another database to appear in the diagram
pane by referencing the table in the SQL statement of the SQL pane. Is there
another way to add the table to the diagram pane (for example by selecting
the table from a list of tables in a given database rather than ... more >>
ISNUMERIC Data Scrubbing Problem
Posted by Don Miller at 4/25/2007 12:11:33 PM
In the process of exporting and scrubbing data from one database to another
(SQL 2000), one of the things I check is if a value in a column from the
original database is "numeric" by testing ISNUMERIC=1 and then appropriately
place that value in a "numeric" column in the target database. I nev... more >>
NULL vs EMPTY
Posted by Daniel at 4/25/2007 12:00:59 PM
Im not sure if im even asking the right thing... but i have a table setup
and it contains probably 10 fields that DO NOT allow NULLS and 5 that do...
When i submit my form, if any field is left empty, the database now has
empty fields and no longer null...
Is there anyway to submit a webfo... more >>
How best store value/pair combinations?
Posted by Ronald S. Cook at 4/25/2007 11:49:02 AM
We're currently doing the data model for all operations at a cattle
feedyard.
We'll have many settings to store at the feedyard level.
I'm thinking our options are:
1) Create a table "Feedyard" and have a column for every setting. Good
because can control the type for each. Bad (I gue... more >>
difficult select statement
Posted by justin at 4/25/2007 11:42:55 AM
Hello, I am having a problem creating a somewhat complicated select
statement. I have written lots of stored procedures before, but only
very simple ones. Here's what I want to do.
I have a table covering types of services, right now there are about
10 but more could be added. So this table "S... more >>
Aggragation Question Part 2
Posted by imani_technology_spam NO[at]SPAM yahoo.com at 4/25/2007 11:40:15 AM
I have summarized two columns using this code:
SELECT DISTINCT
dbo.tblContainer.ID_Container,
dbo.tblContainer.Container_Number,
dbo.tblContainer.Container_TypeName,
dbo.tblLineItem.LineItem_BLNumber,
... more >>
Aggregation Question
Posted by imani_technology_spam NO[at]SPAM yahoo.com at 4/25/2007 11:37:39 AM
I summarized two fields using this code:
SELECT DISTINCT
dbo.tblContainer.ID_Container,
dbo.tblContainer.Container_Number,
dbo.tblContainer.Container_TypeName,
dbo.tblLineItem.LineItem_BLNumber,
SUM(dbo.tblLineItem.LineItem_Cubic_Meters_Volume) AS TotalVolume,
SUM(d... more >>
Converting all char, varchar, and text to nchar, nvarchar, and nte
Posted by Pasha at 4/25/2007 11:24:01 AM
Hi All,
Would it be possible to go through all tables in a given DB and change all
character columns to nchar (from char), nvarchar (from varchar), and ntext
(from text)?
I don't want to go through all the tables manually, so hopefully there is a
way.
--
Thanks,
Pasha... more >>
Why relational division is so uncommon?
Posted by Vadim Tropashko at 4/25/2007 11:16:44 AM
http://vadimtropashko.wordpress.com/why-relational-division-is-so-uncommon/
... more >>
if condition in sql
Posted by anagai at 4/25/2007 10:00:38 AM
What exactly is the syntax for placing a if....else condition in a sql
statement. I know how to do it in a stored proc, but i need to do it
in the sql directly. ms online books not much help.
... more >>
help with Coalesce function
Posted by SqlBeginner at 4/25/2007 9:42:01 AM
Hi,
I have this query,
Select state, zipcode, Sum(Sales) As Sales, Sum(TotIssues) As TotIssues,
'1 : ' +
convert(varchar(20),Convert(Decimal(10,2),round(convert(decimal(8,2),NULLIF(sum(TotIssues),0)) / convert(decimal(8,2),NULLIF(sum(sales),0)),2))) as Density
From (Select state, Substri... more >>
rounding of decimals
Posted by SqlBeginner at 4/25/2007 8:38:05 AM
Hi,
I have values like
14.20588235294
1.56656346749
etc.,
I want to display only the first two digits of the decimal. So i tried it
with Round() function like this Round(column,2). The result comes out as
14.20000000000
1.50000000000
But my desired output is:
14.20
1.50
Is ... more >>
WITH (NOLOCK)
Posted by Darin at 4/25/2007 8:32:14 AM
Can someone give me some info on a SELECT w/ WITH (NOLOCK) on it.
If I have a view that joins multiple tables, does each table need WITH
(NOLOCK)? WHat if the view is made up of a view (A) an multiple tables,
would the view (A) need WITH (NOLOCK) or just the tables in the view
(A) definatio... more >>
Connect to server - list of servers
Posted by DWalker at 4/25/2007 7:50:06 AM
In SQL 2005, Management Studio, the Connect to Server dialog box: The
dropdown box for Server Name seems to hold every alias, every server name,
and every kitchen sink that I have ever connected to.
Some of the names are aliases for others, and I would like to remove them.
I searched the... more >>
TRY..CATCH BLOCK...what am i not getting here.
Posted by roy NO[at]SPAM mgk.com at 4/25/2007 7:31:32 AM
i've written a function that does a divide by zero...so it generates
an error
i call it from the following
....
BEGIN
BEGIN TRY
SELECT dbo.myfunction('ABC', 'c')
END TRY
BEGIN CATCH
PRINT 'CATCH STATEMENT'
END CATCH
END
but the error never gets trapped in the catch block...... more >>
Optimize SQL 2005 Compact Edition
Posted by Jakob Lithner at 4/25/2007 6:36:03 AM
We have a database in Access that needs to be available for Pocket PC.
For a couple of years we have provided a SQL CE 2.0 database with the same
content. Now we moved to SQL2005 Compact Edition on the mobile platform.
We expected query execution times to improve but that was not always the ... more >>
make > 1 display 1 ????
Posted by geoffa at 4/25/2007 5:24:01 AM
distance bill_dist total_charge_n percentage Miles
--------- ------------- ------------------ -----------------
--------------------
523.0 405.0 638.54 1.29135802 522.999998100
522.0 405.0 638.54 1.... more >>
Comparing date with null values
Posted by Manikandan at 4/25/2007 5:06:26 AM
Hi,
I have a doubt of querying a date column
Table Name:Detail
Name(varchar) sdate(datetime,null) ddate(datetime,null) Value(int)
ss 2007-04-03 10:41:12.410 NULL 10
rr 2007-04-03 10:41:12.410 2004-04-03 10:41:12.410 10
tt 2007-04-03 10:41:12.410 2005-04-03 10:41:12.410 10
... more >>
Recovering deleted data
Posted by Kayda at 4/25/2007 4:13:01 AM
Hi:
II have a database that has not been backed up, and a delete command
deleted certain rows from one table.. How can I recover the table to
its original state using the transaction log, and without using a
third party tool?
Thanks,
Kayda
... more >>
T-SQL Debugger Error
Posted by Rahul at 4/25/2007 4:00:53 AM
T-SQL Debugger Error
Hi,
When I debug our sp with T-SQL Debugger, I got following error.
Server: Msg 229, Level 14, State 5, Procedure sp_sdidebug, Line 1
[Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE permission
denied on object 'sp_sdidebug', database 'master', owner 'dbo'.
... more >>
IP Address, Port No in SQLOLEDB ConnectionString
Posted by Jamie_C at 4/25/2007 3:36:01 AM
Hi,
Here's two connection strings. The first works fine, the second gives "SQL
Server does not exist or access denied."... the software is currently on the
same machine as the DB so no Firewall issues (although when it works the DB
will be remote and I will open the port on the firewall). I... more >>
Is SQLCMD redistributable?
Posted by Ronald Green at 4/25/2007 2:11:36 AM
Hi,
Does anybody know whether SQLCMD is redistributable? Can I embed it in
an unattended deployment of my applications (that may use either SQL
2005/2000/MSDE)?
Thanks in advance,
R. Green
... more >>
SPs in multiple similar DBs
Posted by sjur NO[at]SPAM randh.org at 4/25/2007 1:41:48 AM
Hi,
I'm currently in the process of developing a CMS and is forced to make
some architectural descisions in the near future. My plan is to have
all SQL-code in Stored Procedures but my (rather techie) boss is
sceptical. He argues among other things that multiple copies of the
SQL-code (each c... more >>
UPDATES with joins
Posted by Kayda at 4/25/2007 1:07:49 AM
Hi:
I have noticed two different behaviors -- it seems when I do an UPDATE
with a join sometimes it creates another row in the update table if
there is a match, or sometimes it just guesses. For example, here are
two tables:
Table1
ID UPDATEFIELD OTHERFIELD
1 NUL... more >>
Trigger: Fill another Database and use their Stored Procedures (not able to catch the error)
Posted by Dashu at 4/25/2007 12:13:48 AM
Hello everyone,
I face currently a problem where I could need some input for searching
the source of the Problem
System: SQL Server 9.0
I fill from Database A with triggers Database B, everything works
fine.
On Database B there is a Stored Procedures that checks the records and
add ad... more >>
query with NEWID
Posted by luna at 4/25/2007 12:00:00 AM
Say we have a table with the following fields ID, Surname, Address, Town,
Country all are strings
I need to be able to run a query on this table that returns me all the towns
that are equals to 'London' first followed by every other town there after
But we also need to be able to ... more >>
OPENROWSET
Posted by simonZ at 4/25/2007 12:00:00 AM
Can I use openrowset just to execute stored procedure on other server
without returning any result set?
Any example?
Thanks,S
... more >>
Need a simple solution for this if possible
Posted by Daniel at 4/25/2007 12:00:00 AM
I have a form that gathers basic information... i have 2 tables in my db
Is it possible that on insert of the record to the main table, i insert just
1 field into the 2nd table?
This is not what my table is like, but wanted to show a simple example
Ex. Table1
First name
Last name
Gende... more >>
|