all groups > sql server programming > november 2006 > threads for friday november 17
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
Securables
Posted by Leila at 11/17/2006 10:39:19 PM
Hi,
Why a SQL Server Login is securable? How do we secure it?
Thanks in advance,
Leila
... more >>
How to update first Record
Posted by Sundara Murthy at 11/17/2006 10:13:01 PM
Dear Experts,
I have the table it looks like
Table1
Cmpny_Name Anxtr_Num Recvd_Date Qty Item_Desc OGR_Date
AA 01 Null 10
Item1 01/04/2006
AA 01 Null ... more >>
Choose which values to include in UNION?
Posted by ana9 at 11/17/2006 10:01:34 PM
I have the following query:
SELECT Company.CompanyName, Company.Company_ID, AGR_Header.AGR_Name,
AGR_Header.AGR_Amount
FROM AGR_Header INNER JOIN Company ON AGR_Header.RecID=Company.RecID
WHERE Company.CompanyID=@CompanyID AND AGR_Header.AGR_Name=@Agreement
UNION ALL
SELECT Company.CompanyNa... more >>
query help
Posted by Jami at 11/17/2006 8:42:43 PM
Hi!
i have following data set
Location_Name Total_Records Report_Date
east 120 20-Oct-2006
east 3120 21-Oct-2006
east 20 22-Oct-2006
east 344 23-Oct-2006
West 36 20-Oct... more >>
Return the T-SQL for creating a table.
Posted by Jeremy H. at 11/17/2006 7:52:01 PM
Is it possible to return the t-sql on a current table for creating a table?
For a view I use sp_helptext [view] but I can't seem to do this with a table.... more >>
SQL 2005 no longer supporting backup to named pipes (compressing a backup).....
Posted by Robinson at 11/17/2006 7:26:44 PM
Hi,
I read on MSDN that my SQL Server 2005 no longer supports backup to named
pipes for security reasons ( I also wondered why my IClientVirtualDeviceSet2
didn't work either.....). How can I effectively replace this functionality
(including virtual devices), so I can perform a backup and c... more >>
Newbie parameter question revisited
Posted by Alan at 11/17/2006 5:02:12 PM
I thought this was working a few days ago, but have since found it isn't.
Here is my procedure:
CREATE PROCEDURE [dbo].[qGetBanner]
@BannerPage varchar(50)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @BannerID int
SELECT TOP 1
BannerID = @BannerID,
BannerFileName,
AltText,
URL,
V... more >>
Compatibility problems porting an App from SQL 2000 to 2005
Posted by John Kotuby at 11/17/2006 4:22:45 PM
Hi all,
Is there a book or large article somewhere that points out the differences
in SQL 2005 and 2000 in terms of the problems one might encounter after
moving TSQL Procs from SQL 2000 to SQL 2005.
Here is an example:
We have a large business application that has been running fine on SQ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
conditional where clause
Posted by samuelberthelot NO[at]SPAM googlemail.com at 11/17/2006 3:31:23 PM
Hi,
I have a bit field in my table (0 or 1). If I pass a parameter with the
value 1 to my stored procedure I should return only the records with
this bit field set to 1, otherwise I should return ALL the records.
So my stored procedure looks like this:
CREATE PROCEDURE sp_PM_GetPublicatio... more >>
Question: Is there a way to count the number of executions of a stored procedure
Posted by DeadZone at 11/17/2006 2:55:07 PM
Hello,
Does anyone know if it's possible to keep track of the number of
times a stored procedure is run? (by any and all users.) I want to
try to clean up an existing legacy system which is full of old stored
procedures. Many of which I believe are no longer used. But the
source code is... more >>
Define 2 Periods of Consecutive Time that Cross Year Boundary?
Posted by Dan at 11/17/2006 2:51:48 PM
Hi,
I would like to tell SQL Server via its supported SQL to take two time
periods, say 11/1/05 to 10/31/06 called Period1 and 11/1/04 to 10/31/05
called Period2, and then have it summarize say sales by customer for
these 2 periods in order to compare Period1 to Period2 by customer etc.
... more >>
Recursion problem [SQL Server 2005]
Posted by Bob at 11/17/2006 2:23:13 PM
Hi there,
I have a recursion problem with SQL Server 2005 SP1.
From the DDL and data below I need to find for each row a value called N which has the formula:
N =(19 x PDN + trueRange)/20
Where
PDN is the previous day’s N
trueRange is a column in the prices table.
As it’s a recursi... more >>
yes no field
Posted by BillyRogers at 11/17/2006 1:18:01 PM
How should a field be set up in a table? The field should only accept the
words Yes or No.
I thought there is probably something better than what we currently have
[CBanker] nvarchar (3)
Should this be a boolean? I don't want a number but the actuall words
'Yes' or 'No'.
Is there so... more >>
Suggestions for Updating Fact Table
Posted by Ctal at 11/17/2006 1:12:17 PM
I have a data warehouse with a fact table that's used to load an OLAP
cube. Business users want the ability to modify some of the fields in
the fact table before the data load. Current data loads take place
through an SSIS process that runs on schuedule or on demand. The fact
table is dropped... more >>
aggregate functions
Posted by Mike at 11/17/2006 1:03:21 PM
You know how when there is more than 1 row matching your query, you can
do an aggregate function on a column to just get the value in 1 of the
rows?
Like...
Select Max(Row_ID) From MyTable
But if you want the values of the other columns in that row, is there
any way to get them in the sa... more >>
Stored Procedure question
Posted by AlBruAn at 11/17/2006 12:55:01 PM
I have a stored procedure to delete a record from one table based on a Select
statement going against two other tables. I keep getting a "An expression of
non-boolean type specified in a context where a condition is expected, near
','." error message when I try to execute it. My attempt is a... more >>
sum function
Posted by someone NO[at]SPAM js.com at 11/17/2006 12:13:45 PM
hi, I found the sum function will return null, how to force to return 0
instead of null? thanks.
... more >>
SQL 2000 SP4 Problem
Posted by Kodiak at 11/17/2006 11:55:39 AM
I am trying to create this stored procedure, but I keep getting this
error below. I am not sure what is causing the error? Any help
provided is appreciated! Please look at my SP code for reference.
Server: Msg 170, Level 15, State 1, Procedure test, Line 7
Line 7: Incorrect syntax near 'xml... more >>
Is there an easier and more straight forward way of creating an SQLServer table from a .Net dataset?
Posted by Frankz at 11/17/2006 11:42:32 AM
Hi, I am new to this group so forgive me if this question sounds too
newbie. :-)
I am writing a C# program. One of its functionalities is to use a .Net
dataset to create and populate a table in the SQLServer database. I
suppose I can
1) iterate through the column names of the .Net data... more >>
put a select statement resultset to a text file with the filed names
Posted by mecn at 11/17/2006 11:23:50 AM
Hi,
I need to put a select statement resultset to a text file including the
fieldname.
FiledA FieldB FieldC
ABC Test 1
BCD Test1 23
.....
Thanks
... more >>
UPDATE and Transaction Log in SQL2005
Posted by Kevin S. Goff at 11/17/2006 11:23:32 AM
Hello, all
In SQL 2005 [or even 2000], if i say...
UPDATE MyTable SET MyColumn1 = @MyColumn1, MyColumn2 = @MyColumn2
WHERE PrimKey = @PrimKey
....and the value of the 2nd parameter @MyColumn2 is the exact same as
the existing column, will both columns referenced in the UPDATE
statement b... more >>
c# Problems with COM Interop releasing an object
Posted by MikeMcG at 11/17/2006 11:04:01 AM
I'm having problems with a C# assembly that is being used in a stored
procedure from SQL Server 2000. I created an interface to the .Net assembly
where I set ComVisible(true). I then use Regasm /tlb to create and register
a type library for the control. Now the control looks and acts like a... more >>
Proximity word search
Posted by Robert at 11/17/2006 10:26:01 AM
Hi
I am trying to write a proximity word search, for example if we have a
company name table and one of the record in the table is "IBM Software" and i
as a user enter the company name "IBM Sfware" i want to be able to offer the
customer "Did you mean IBM Software"
Thanks... more >>
EXEC sp_executesql @selectString,
Posted by mecn at 11/17/2006 10:15:07 AM
Hi,
How do I assign the select statement result to a variable?
Select @Myvariable = Exec SP_Executesql @Selectstring
It donesn't work.
Any ideas?
Thanks
... more >>
Select and Print from a variable
Posted by sharman at 11/17/2006 10:07:01 AM
Hi,
I am reading some values into a varchar variable. When I SELECT the variable
I get a partial value, however when I PRINT variable, it prints the entire
contents. What might be causing this? Thanks in advance.... more >>
Problem with top 1. urgent help needed
Posted by Rajeev at 11/17/2006 9:15:13 AM
If i remove the added code and run the below query, i get the following
output ( for fileid 1591673)
SELECT
HSA.Fileid,
--PPA.CoordinatorLastNm,
--PPA.CoordinatorFirstNm,
PPA1.LastNm + ',' + PPA1.FirstNm AS CSCName,
PPA1.ElectronicNo AS CSCEmailId
--PPA2.LastNm + ',' + PPA2.FirstNm AS R... more >>
Aggregating Subselects / Unique Running Total
Posted by Eeraj at 11/17/2006 8:18:02 AM
given this data:
dwnload_key user asset
dwnload_date
----------------------- ------------------------------
------------------------ ----------------------
1 ... more >>
Cannot resolve the collation conflict Error
Posted by amjad at 11/17/2006 6:57:02 AM
I have two databases and recently i upgrade my serve from 2000 to 2005 after
that i am getting that error when i try to run query accross these two
databases. ... both databases was on 2000 server...
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS"
and "Latin1_Ge... more >>
concatenate multiple rows into one
Posted by sharman at 11/17/2006 6:54:02 AM
Hi,
I have a table that has two columns and has some data like:
table1:
Col1 identity int
Col2 varchar (100)
Col1 Col2
1 aaaa
2 bbbb
3 cccc
4 dddd
When I concatenate all the values in Col2 into a single row by doing the
following -
declare @var varchar... more >>
copy a row from table in one server to the table in other server
Posted by xk at 11/17/2006 6:43:02 AM
Hi,
I have QA and Production servers which have the same tables
I just add one column in a table in QA, I want to copy this column's data
to the table in Production.
I tried DTS, but it was doing to insert new rows, but I want to update this
column for existing rows.
Is there anyone h... more >>
Embedding database in app using SQL 2005 Standard edition.
Posted by Adil Akram at 11/17/2006 6:32:03 AM
I have SQL Server 2005 Standard Edition and Visual Studio 2005 Pro (without
SQL Express) installed on same machine.
I want to embed the SQL Server 2005 DB into my C# 2.0 application when I try
adding SQL Database item in the project it gives the error message
"Connections to SQL Server f... more >>
What type to use: xml or ntext
Posted by Pawel Pabich at 11/17/2006 6:32:01 AM
Hi,
I have to store serialized objects in my database. I decided to store
them as xml documents and now I'm wondering what type to choose: xml or
ntext. I'm using Sql 2005. I'm not going to query this column or use
any XML related features. In short I'm wondering which one is more
efficient.
... more >>
Getdate function
Posted by Oded Dror at 11/17/2006 5:22:28 AM
Hi there,
I'm using SQL 2005 and I want to retrieved orders only from yesterday
SELECT OrderNumber, CONVERT(varchar(30), OrderDate, 101) AS OrderDate
FROM dbo.Orders
WHERE (CONVERT(varchar(30), OrderDate, 101) = GETDATE() - 1)
but no result
how do I use the getdate() func... more >>
Identify # table in called proc that was created in calling proc
Posted by Jason at 11/17/2006 5:04:48 AM
Hi
Stored Proc A creates #temp_data and then calls Stored Proc B.
How can SP B check what column names are in #temp_data ?
I thought of looking at syscolumns and sysobjects but the table I'm
looking for looks something like this :
"#temp_data________________0000123456". Which would mean I... more >>
Trigger and stored procedures
Posted by AlBruAn at 11/17/2006 2:14:01 AM
Hi all,
I have a Visual Studio Windows Forms application that accesses data via
stored procedures. If the user desires to delete a record from a table, it's
accomplished by calling the appropriate sproc, passing in the record's ID.
Deleting the record fires a trigger that copies the recor... more >>
RENDER Reports
Posted by somuthomas NO[at]SPAM gmail.com at 11/17/2006 1:23:59 AM
Hi,
Can multiple parameterised reports be combined(or rendered) into one
PDF or MHTML format? How is it done?
Note: The reports generated have same structure but the values in the
fields as the input parameter changes.
Thanks in Advance
Regards,
Somu
... more >>
newbie: compound keys
Posted by R.A.M. at 11/17/2006 12:21:13 AM
Hello,
I am learning SQL Server 2005. I designed some database in which I had
tables with primary and foreign keys containing a few columns. My friend, a
programmer, said that this is not a good design in SQL Server because of
performance; he told that I should have keys with single column co... more >>
Using variable in Cast function.
Posted by Kay at 11/17/2006 12:00:00 AM
All,
I need to write a code in SP for a badly designed DB architecture.
What I want is to use a variable to define decimal places in Cast function
in Select statment.
Value for @i can be anything from 1 to 4.
Declare @val Numeric
Declare @i Numeric
Select @val=123
Select @i=1
Selec... more >>
Ordering Tasks in DTS
Posted by ricky at 11/17/2006 12:00:00 AM
Good Morning
I have a DTS package, whereby I have several datapumps, transferring data
from SQL to Access etc.
The issue now is, that I wish to execute certain tasks in a special order,
due to dependencies.
However I cannot seem to stipulate the order, even though I have set up
Workflows... more >>
Find max of adjacent columns
Posted by Bob at 11/17/2006 12:00:00 AM
Hi,
Say I have a column with a date and three numerical columns a,b,c. Something like:
CREATE TABLE getmax
(
[date] datetime,
a money,
b money,
c money
)
I need a query that returns the [date] and the max of a,b,c for each date. Is that easy to do?
Thanks in advance,
B... more >>
T-SQL typeof() equivalent?
Posted by Kev at 11/17/2006 12:00:00 AM
Hello all,
Can anybody tell me if there is a way to determine the data type of an
object within a stored procedure or function?
I have no use for this I am just interested if and how this could be
achieved.
Cheers
... more >>
Query on phone number field
Posted by Kim at 11/17/2006 12:00:00 AM
Hi
I am wanting to create a query which will do the following,
I have a database with a phone number field, the phone numbers
are in the following format:
5437 2211
3288 1111
What I want to do is first add 07 to the start of the number and
remove any white space to get the following r... more >>
|