all groups > sql server programming > july 2007
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
SQL Server 2005 Endpoint
Posted by chfran at 7/31/2007 9:24:38 PM
Here is my endpoint script.
CREATE ENDPOINT XMLImport
STATE = STARTED
AS HTTP (
path='/sql',
AUTHENTICATION=(INTEGRATED),
PORTS = (CLEAR)
)
FOR SOAP(
WEBMETHOD 'XMLTEST' (NAME = 'db_chad.dbo.XMLTEST' ),
WSDL = default,
BATCHES=DISABLED,
database='db_chad'
)
GO
F... more >>
SQL Server 2005 create table
Posted by WRH at 7/31/2007 8:11:50 PM
Hello
I have a legacy VS C++ program which works well with SQL Server 2000,
creating
tables etc as required. The same program does not work with Server 2005
express,
eg CREATE TABLE fails. Is this a known issue with a fix or do I need to
rewrite
code?
... more >>
Generate ALTER scripts
Posted by cbtechlists NO[at]SPAM gmail.com at 7/31/2007 8:05:09 PM
How do you generate ALTER scripts for all Views, Procs & UDFs in the
database into individual files? I would like to do the same thing that
I can do when I right click a database, select Tasks/Generate Scripts,
but I would like them to be ALTERs not CREATEs.
If not, is there another way to do ... more >>
SqlServer 2005 Express Edition
Posted by Hugo Nugra at 7/31/2007 7:47:19 PM
Hello
Is possible to connect with SqlServer 2005 express edition from other
machine?
... more >>
Updating statistics based on the row sample
Posted by melbrankin NO[at]SPAM gmail.com at 7/31/2007 6:24:21 PM
Hi all
I have several databases on SQL 2000 sp 3a + that I am looking after
and want to maintain their statistics.
The problem I have is that the tables can have millions of rows which
gives me the following issues:
1. the default sample size does not appear large enough to keep stored
... more >>
Need help with INSERT and UPDATE
Posted by mitra at 7/31/2007 4:38:03 PM
I have two tables that I need help with inserting and/or updating.
The tbl_1 table has data but there is no data in the tbl_2 table.
Some of the columns in the tbl_2 table need to be updated with data from
some of the columns in the tbl_1 table and the rest I need to pass the values.
Below is... more >>
Specifying each fields in insert SqL
Posted by ykffc at 7/31/2007 4:32:02 PM
Assume each record in one table called "oraTab" of a Oracle Database Table
need to get copied to another table in SQL Server. Most data are just copied
field by field, except.... see next.
Assume the SQL table is defined in such a way that all fields have defaults
and do not allow nulls. In... more >>
How to query for any string in SQL Server 2005
Posted by spdude at 7/31/2007 4:05:13 PM
Is there a way I can query for a string in any field in any table in a
database? For example, I would like to do something like this:
SELECT * FROM <any table> WHERE <any field> LIKE '%mysearchtext%'
Thanks!
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
System Table?
Posted by Mitch at 7/31/2007 3:04:02 PM
When you try to back up a transaction log before the database has ever had a
full backup, is there a system table that stores that information? Like if
such and such is 0, then log can't be backed up....
Thanks,
Mitch... more >>
dynamic calculate discount in sale order
Posted by TedQuan NO[at]SPAM gmail.com at 7/31/2007 2:50:28 PM
Hi all,
I have a question on how to calculate volume discount dynamically.
The following is my setup:
My cost table:
Product_Code Discount_Lowwer_Bound Discount_Upper_Bound Price
ItemName 1
500 $100
ItemName 501
1000 $80
... more >>
How can I change the windows name?
Posted by Max2006 at 7/31/2007 1:49:08 PM
Hi,
I have a SQL server 2005 installed on windows 2003.
I have to change the NetBios name of windows. Is there any set of
instruction to reconfigure the SQL server to work with the new windows
server name?
Thank you,
Max
... more >>
Temporary table usage
Posted by Curious at 7/31/2007 1:03:58 PM
I have a query that uses a temporary table, tmpServicesWithAgentID. I
just wonder if I can use a temporary table the same way as a regular
table in an INNER JOIN statement below:
SELECT TOP 1
@ErrorText = ErrorText,
@AgentName = a.ServerName
FROM #tmpServicesWithAgentID
INNER JO... more >>
NOT EXISTS
Posted by CLM at 7/31/2007 12:42:00 PM
Can someone tell me high level what this is doing? I have never been able to
understand the purpose of this kind of NOT EXISTS (SS 2000). This is the
bottom part of the WHERE cluase off of a rather lengthy query:
AND NOT EXISTS(
SELECT NULL
FROM
dbname.dbo.tblname fsep
WHERE
fsep.Syste... more >>
GROUP BY and OVER()
Posted by lucik333 NO[at]SPAM gmail.com at 7/31/2007 11:55:18 AM
Hi,
I'm having trouble figuring out why in one case OVER() and GROUP BY
work together, and in another they don't. I do feel that it's got
something to do with CTE, not quite sure how exactly. Maybe someone
could point me in the right direction?
Here we go:
--this works fine with both OVE... more >>
Need help with creating a new SQL Query
Posted by Sam at 7/31/2007 10:03:21 AM
I would really apprecaite help with creating a SQL Query
Batch Table which is the header table and each batch table has
multiple GLTran records which are the transaction records per batch.
Some batches have multi company transactions which is the value in the
CPNYID coloum.
So some batches (n... more >>
folding timeseries
Posted by B D Jensen at 7/31/2007 6:53:50 AM
Hi!
Do anyone have an idea how make data more compact:
table t
amount money,
mtime smalldatetime
5, 2007-05-01 01:01:00
5, 2007-05-01 01:02:00
6, 2007-05-01 01:03:00
5, 2007-06-01 05:00:00
5, 2007-06-01 05:01:00
should result in
table tt
amount money
beginTime smalldatetime
endTi... more >>
select records randomly
Posted by sweetpotatop NO[at]SPAM yahoo.com at 7/31/2007 6:02:35 AM
Hi,
I know I can select records randonly thru' SQL by using the following
query:
SELECT TOP 100 * column_list
FROM table_name
ORDER BY NEWID()
Question:
If I want to break this group randomly further, how would I do it? Do
you think taking the first 25 records into group 1, ... more >>
EPOCH DateTime Conversion >= 4 days
Posted by Marc at 7/31/2007 5:44:59 AM
Hello,
I could use some help regarding converting an EPOCH datetime value, combined with getting the results greater than or equal to 4 days based on a normal SQL server datetime value.
I'm able to convert the EPOCH datetime value such as:
DATEADD(s, DATE_OPENED, '19700101') AS CONV_DATE_... more >>
Linked server in Stored procedure
Posted by Anders at 7/31/2007 2:36:00 AM
Hi all
MSSQL2000
From within the Enterprise Manager, I have created a linked server (in the
sub item "security"). I have named it as "MyLinkedServer"
After this, I try to create a new view:
SELECT * FROM MyLinkedServer.MyDatabase.dbo.MyTable
And this works fine (The view itself add a cert... more >>
sql instead trigger change the data type
Posted by ganesh at 7/31/2007 2:33:27 AM
Hi There
i've a field integer in my table, when i import sql file which
contains sql lines like insert the sql insert contains string which
should be stripped off when i import data into table.
Is there any way can i use instead trigger to strip off this field. I
would pass the sql like thi... more >>
move data between MDB and MSSQL server
Posted by prakashdehury NO[at]SPAM gmail.com at 7/31/2007 1:40:23 AM
Hi
I have to move around 100k rows between MDB to SQL server and move
back the rows to from SQL Server to MDB.
The MDB file can be any as specified by user. and MSSQL server is
fixed.
What are the different efficient ways to move the data between MDB and
SQL server.
Thanks,
Prakash
... more >>
Passing columns to CLR function
Posted by Shlomi at 7/31/2007 12:22:03 AM
Hello,
I am trying to send to colums to SQL CLR function and get some results. I
want the CLR code be like:
public void DoSomething(SqlDouble[] a, SqlDouble[] b, out SqlDouble x, out
SqlDouble y, out SqlDouble z)
{
//Do Something...
x = ....
y=...
z=...
}
I want to call this code fro... more >>
SQL 2000 Datatable Default value question
Posted by Jason Huang at 7/31/2007 12:00:00 AM
Hi,
In my SQL 2000, I would like to have a field which default value is "00000",
what kind of datatype should I use?
Thanks for help.
Jason
... more >>
function exists
Posted by Bpk. Adi Wira Kusuma at 7/30/2007 11:45:31 PM
statement 1:
EXISTS
(SELECT *
FROM publishers
WHERE pub_id = titles.pub_id
AND city LIKE 'B%')
statement 2:
EXISTS
(SELECT City
FROM publishers
WHERE pub_id = titles.pub_id
AND city LIKE 'B%')
Do both statements have the same best performance? Or Statemen... more >>
Hex to Int Conversion
Posted by shiju at 7/30/2007 11:26:21 PM
Is there any way to convert a Hex passed as varchar
Below works
select cast(0xAD as int)
But not this
declare @name varchar(10)
select @name= '0xAD'
select cast(@name as int) --Gives a conversion error.
Thanks
Shiju Samuel
... more >>
CREATE composite index error
Posted by Curious at 7/30/2007 7:33:43 PM
I try to create an index that references three columns in a table:
---------------------------------------------------------------------------------------
CREATE UNIQUE NONCLUSTERED INDEX [AK_DataReadyStateCache_Unique] ON
[dbo].[DataReadyStateCache]
(
[DataReadyStateTypeID] ASC,
[Questi... more >>
searching for one field within another
Posted by Rahul Chatterjee at 7/30/2007 6:46:44 PM
I am joining 2 tables using a bunch of criteria - I also want to check for
the existence of data from one field in one table to another field in the
other table
e.g
I have "streetaddress" in one table "Barton", the other table has "address"
field "1020 BARTON RD". I want to match if stre... more >>
How to get yesterday's date in a query
Posted by Michael at 7/30/2007 6:42:24 PM
Hi,
I am using MS SQL2000.
I tried to use the query to do the following. Why does it not work
out? I could not get DateAdd("d",-1,Today) work correctly.
select distinct a, count(*) from test where [timestamp] >
DateAdd("d",-1,Today)
group by a
Thanks a lot for your help!!
Michael
... more >>
Finding the next sequential number in a series
Posted by Kirk at 7/30/2007 6:10:08 PM
Hello,
I have a table where one field is a part number. These part numbers
consist of a "base" number, then a dash ("-") and then a dash number.
Examples: 300-102, 1534-32, 98872-12345.
I would like to create a SP where I pass it a base number and it
returns the next sequentially available... more >>
how to change database context
Posted by Helmut Woess at 7/30/2007 5:02:36 PM
Hi,
changing the database per name is no problem
USE master
GO
.... and everything is okay. But i need this in a script and have the
database name in a variable. How to make this?
select @cmd = N'use ' + @oldDb + N';GO'
exec sp_executesql @cmd
doesn't work. Is something possible a... more >>
Conditionally select fields
Posted by Robert Hancox at 7/30/2007 4:49:24 PM
I'm trying to create a mailing list using a query. Simple enough.
I have two tables. One is 'Practices' (doctor's offices), a parent table,
and the other, 'Members', is a child table that has all the people who work
for these practices. There is address information in both tables. If an
ind... more >>
Custom Report Delivery Extension not showing up as an option in the Subscriptions screen.
Posted by Rico at 7/30/2007 3:55:44 PM
Hello,
I've implemented the sample Printer Report Delivery extension in my
installation of SSRS (SQL Server 2000). However, for some reason the
Printer option doesn't show up in the combo box of the Report Delivery
Options. Any ideas what I should look for? According to the tutorial, all... more >>
Help! Having trouble Imlementing Report Services printer delivery extension sample
Posted by Rico at 7/30/2007 3:40:33 PM
Hi All,
I've been trying to implement the sample Report Services Printer Delivery
extension. I've been through the tutorial and haven't been able to add the
following security code group (shown at the bottom) successfully, since
there is no indication of where this should go or why. I not... more >>
variable where clause
Posted by rodchar at 7/30/2007 3:02:02 PM
hey all,
select * from categories
where categoryid = 1 or categoryid = 2
what's the best way to create a stored procedure that would accept a
variable amount of categories for the where clause?
for example if i just wanted to search for categoryid = 1 instead of both 1
and 2.
thank... more >>
Sql Help
Posted by Arul at 7/30/2007 2:18:06 PM
I'm using Sql Server 2005. I have a table with two columns; PropertyName and
PropertyValue. PropertyName has values like LastName, FirstName, Title and
PropertyValue has the valus for those PropertyNames. Ex:
AccountName Doe
FirstName John
LastName Doe
Manager Jane Smith
AccountName Cram... more >>
cannot attach db
Posted by Keith G Hicks at 7/30/2007 1:52:03 PM
I had a development system crash (OS HDD failed) and had to reload things
recently. My data drive and backups of that were intact. I reinstalled SQL
2k and tried to reattach the mdf files. Here's what I did in QA:
EXEC sp_attach_single_file_db @dbname = N'Caser', @physname =
N'D:\Data\MSSQL\Da... more >>
how can iwe identify tht the page is post back?
Posted by harry at 7/30/2007 1:31:07 PM
how can iwe identify tht the page is post back?
... more >>
Replace the LAST ',' with '='
Posted by Curious at 7/30/2007 1:30:13 PM
I have a string type of column called 'Question' in a table,
DataReadyStateCache. Each record for this column contains 7 commas
(',') in the middle of the string. Each record for this column is in
the format of:
substring1,substring2,substring3,substring4,substring5,substring6,substring=
=AD
... more >>
can i use "order by clause"in a sub querry
Posted by harry at 7/30/2007 1:23:54 PM
i have to find 7 th highest salary in a table.
i use order byb clause in a sub quarry?
is it work?
... more >>
DDL trigger with rollback
Posted by Sammy at 7/30/2007 1:22:11 PM
Hi the BOL DDL trigger below is it possible to add rollback to it and still
see changes that people have made to the database schema. I have tried with
the rollback and nothing is entered onto the ddl_log table. I would like to
capture all events even if rolled back is this possible.
thank... more >>
Querry
Posted by harry at 7/30/2007 1:20:18 PM
I have a table of 10,000 rows .i have to made 1 cluster index and some
non cluster index in that table.what i should make first i.e. made
cluster index first or make non cluster index?
... more >>
Replace the LAST ',' with '='
Posted by Curious at 7/30/2007 1:06:45 PM
I have whole bunch of rows in a table that contain 7 commas (',') as a
separator. Each row is in the form of:
substring1,substring2,substring3,substring4,substring5,substring6,substring7,substring8
I'll need to replace the LAST ',' with a '=' for each row of data.
What's the most efficient S... more >>
When does SQL 2000 become officially 'unsupported'?
Posted by Mike Whiting at 7/30/2007 12:46:01 PM
Does anyone know if Microsofts' obsolesence policy still holds? That is, when
a product is 2 versions behind, it is no longer supported with SP's and
hotfixes? So, when SQL 2008 comes out, will SQL 2000 still be supported?
I'd certainly expect that PSS would still take call on it, but most of... more >>
full backup no login
Posted by rodchar at 7/30/2007 12:42:02 PM
hey all,
i'm doing a full backup from SQL Management studio and when i go to restore
that database on a different server my user-defined login doesn't show up.
I have to delete the old login which shows up in the database users and then
recreate the user in Logins and remap to database.
... more >>
Calculating Averages
Posted by Anonymous at 7/30/2007 12:18:08 PM
SQL Server 2000
I have a simple select statement to calculate the average:
SELECT avg(duration)
FROM tablename
The problem is the average is being rounded incorrectly. For example, if I
am calculating the average of 718, 721, 1032 the avg is 823.6. However, the
avg is coming out to 8... more >>
Export SQL data into Excel on a remote server
Posted by Goran Djuranovic at 7/30/2007 12:15:49 PM
Hi all,
I am unable to export a small table (50 rows) into an excel on a remote =
machine (called MyPC in this case). I run the following code in a Query =
Analyzer:
SELECT * FROM OpenRowSet('Microsoft.Jet.OLEDB.4.0', 'Excel =
8.0;Database=3D\\MyPC\testshare\testing_new.xls;', 'Select * From ... more >>
Help with query ...
Posted by Jamie Risk at 7/30/2007 12:08:33 PM
How can I create a query for the following that will return
results for say;
* 'Phoned' and not 'Ordered' -> ('Harry')
* 'Phoned' and not 'Invoiced' -> ('Dick' & 'Harry')
- Jamie
CREATE DATABASE [test_db]
GO
use [test_db]
GO
CREATE TABLE [dbo].[Customer]
(
[id_Custom... more >>
Error, "Invalid length parameter passed to the substring function"
Posted by Curious at 7/30/2007 11:31:36 AM
When running this huge select statement, I got an error:
"Invalid length parameter passed to the substring function"
The statement is as below:
---------------------------------------------------------------------------------------------------------------
SELECT
DataReadyStateCacheID,
... more >>
How do we create compound foreign key?
Posted by beginner16 at 7/30/2007 11:17:34 AM
hello
I use MS SQL server
1)
Example of a table with compound primary key would be:
CREATE TABLE A ( b integer,
c char(5),
d integer,
PRIMARY KEY ( b, c )
);
But how do we create compound for... more >>
XML datatype parsing error.
Posted by Arne Garvander at 7/30/2007 9:52:04 AM
I am trying to update a column that has the XML datatype.
I get this error
XML parsing: line 4, character 16, unexpected end of input
when executing the sql below. What am i doing wrong?
declare @temp nvarchar(100)
set @temp =N'<books>
<book name="Golf for dummies" />
<book name="Footba... more >>
|