all groups > sql server programming > june 2007 > threads for monday june 18
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
I ve problem with union
Posted by Bpk. Adi Wira Kusuma at 6/18/2007 10:40:50 PM
I use Sql Server 2000. I've structure like it:
Create table T1(
RID int primary key,
A varchar(8),
...
...
)
Create table T2(
RID int primary key,
A varchar(8),
...
...
)
To make easy to view, so I make a view like it
Create view VUni as
Select ... more >>
using identity on select into
Posted by Roy Goldhammer at 6/18/2007 8:03:06 PM
Hello there
I'm creating new temp table using select into statement.
the temp table has has 2 main fields:
rowid id identity(1, 1),
Sign bit
and all other fields from another table choosed dinamicly by parameter.
it works fine exept tables which has their own identity field. in this c... more >>
Can we randomly select ONE record from a group?
Posted by Andrew at 6/18/2007 6:52:00 PM
Hello, friends,
I am not that good in SQL programming, so please help.
I need to randomly select just one record from unknown number records that
belong to the same group, say grouped by CategoryID.
I know I can do it in C#.net like the follows:
Query SQL Server for the toal number of ... more >>
database design questions - thoughts welcome
Posted by at 6/18/2007 6:43:42 PM
I am working on a database driven application and would like to run
some concerns I have past some other people! The system is being used
to track the process of student's following various courses. The
courses are static and have a predefined 'plan'. This is represented
in various tables where ... more >>
Automate column name change over many tables?
Posted by Dean Slindee at 6/18/2007 6:30:30 PM
I would like to change the name of a column that appears within dozens of
tables in one database. That same column name also appears within hundreds
of stored procedures in the same database.
I could manually change each table column name, and then manually changing
each stored procedu... more >>
currentDb function
Posted by Roy Goldhammer at 6/18/2007 5:58:22 PM
Hello there
IS there a way when i run procedure to know from which database i run it?
on server there is @@servername and for users there is SUSER_SNAME()
is there is something like this for the current database?
... more >>
Conditional Where Clause Problem
Posted by navvyus NO[at]SPAM yahoo.com at 6/18/2007 5:14:03 PM
I get an error at the conditional where clause :
Incorrect syntax near the keyword 'BETWEEN'.
Code where the problem is caused:
Where
Case When OrderLineItems.datetime_refunded = OrderHeader.date_created
THEN
OrderHeader.date_created BETWEEN @DateFrom AND @DateTo AND
OrderLineItems.ItemSt... more >>
Conditional Where Clause
Posted by navvyus NO[at]SPAM yahoo.com at 6/18/2007 4:59:36 PM
I get an error at the conditional where clause. The Case When use
inside the Where clausing is causing this problem:
Incorrect syntax near the keyword 'BETWEEN'.
Can someone suggest how to use Case inside Where. This is the code in
Where clause that is causing the error. I have included the enti... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
pass values
Posted by seema at 6/18/2007 4:03:01 PM
I have the following Stored procedure. There is column named
"tcktreceived" in my database and I want to pass all the rows one by
one to the parameter @starttime. I don't know how to do it.
CREATE PROCEDURE [twcsan].[usp_DateDiff]
-- Add the parameters for the stored procedure he... more >>
Find out what uses a certain Function????
Posted by Theresa at 6/18/2007 2:46:02 PM
Hello!!
Im trying to find out which views, stored procedures, and other functions
use a bunch of functions that I have created. Is there a system view/SP I can
run to view this information. Thank you!!!!!... more >>
Creating a table using code with seed identity from parameter
Posted by Sammy at 6/18/2007 2:19:01 PM
Hi I am automating a merge of databases and there ids are int identitys (1,1)
i am trying to create a list of new numbers where there are duplicates by
getting the max id of one table and generating a new list on numbers bu my
code is failing as below. Is this possible to create a table automa... more >>
Getdate
Posted by seema at 6/18/2007 2:19:01 PM
How can I get Current date in Stored Procedure.
Datetime.now doesn't work.
GetDate also dioen't work for me.
Thanks,
... more >>
Quick question about linking from SQL Server to a foxpro db
Posted by B. Chernick at 6/18/2007 1:54:25 PM
Ok, I have virtually no experience in FoxPro so tell me if this is possible.
I have created a very simple table within a FoxPro6 database. (At least I
think that's the correct terminology)
I have already created a link within my local instance of SQL Server 2000
using the command: EXEC sp... more >>
passing a job parameter to an SSIS package
Posted by bradbartel NO[at]SPAM hotmail.com at 6/18/2007 1:30:51 PM
I need to get the job name that is running my SSIS package. Then I
need to take that job name and get it's value into a table via a
derived column. I figued the first step in my job would be setting a
variable for the job name like this.
declare @jobid as uniqueidentifier
declare @varJobNam... more >>
Return Value from Stored Procedure
Posted by seema at 6/18/2007 12:52:27 PM
I have a stored proceure whic is returning a table. Now I need ADO.Net
statement So that IO can pass parameters to this stored procedure and get
Retuened table from stored procedure.
Could you please send me code how can I reterive a returen value of tyoe
table from stroed procedure in ADO.... more >>
Programatically getting the Windows version
Posted by JR at 6/18/2007 12:51:01 PM
Does anyone know how to programatically get the version of Windows a SQL
Server install is running under? This would be specifically for SQL 2000 sp4.
Thanks!... more >>
Change Ownership of a Table
Posted by KoDell at 6/18/2007 12:42:01 PM
When I log into Enterprise Manager using the administrators account
and I create a new table in a database the owner is always "User".
How can I change that to another user?
There doesn't seem to be any place in the Properties that allows me to
change either database or table owners.
... more >>
Stored Proc
Posted by seema at 6/18/2007 11:57:01 AM
I have the following stroed procedue. But whebnnI execute it it gives me
following errors.
Could you please tell me what is wrong
Msg 156, Level 15, State 1, Procedure usp_DateDiff, Line 43
Incorrect syntax near the keyword 'SELECT'.
Msg 156, Level 15, State 1, Procedure usp_DateDiff, Line ... more >>
Syntax ADD Foreign Key to a table (different collation on field)
Posted by Xavier at 6/18/2007 11:41:02 AM
How is the syntax to add a foreign key for a table on a field which has in
the two tables different COLLATION
TABLE1 -> FIELD1 (Latin1_General_CI_AS) type nvarchar(18)
TABLE2 -> FIELD1 (Latin1_General_CS_AS) type nvarchar(18)
The FIELD1 is unique in TABLE2
ALTER TABLE [MyTable] WITH NOC... more >>
Error 7303 when trying to import Excel file
Posted by DC at 6/18/2007 9:57:03 AM
Hi,
I am using two similar SQL Server 2005 boxes. In a proc on both
machines I use
SELECT *
FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0',
'Data Source="\\server1\files\data.xls";
User ID=Admin;Password=;Extended properties="Excel
8.0;HDR=NO;IMEX=1"')...Sheet1$
This has been work... more >>
File System Task - variable definition
Posted by doofy at 6/18/2007 9:52:21 AM
I'm taking baby steps in using Visual Studio to automate a task.
I'm needing to take an existing file, and save it to a new file, with
the current date as part of the new file name.
I've dropped the File System into my control flow, filled in the source
info, but don't know what to put for... more >>
SHOWCONTIG causes blocking
Posted by Leon Shargorodsky at 6/18/2007 9:32:00 AM
I execute DBCC SHOWCONTIG ('TableName') WITH TABLERESULTS, ALL_INDEXES,
NO_INFOMSGS
It causes heavy blocking on a server, even SPID 1 is being blocked by my
process. Is there any way to avoid blocking while running DBCC SHOWCONTIG?
Thank you in advance,
Leon... more >>
Synchronising flat files with database updates
Posted by Debbie R at 6/18/2007 9:21:04 AM
Hello everyone!
We have a database that contains links to flat files in one of the tables.
The flat files are created/updated/deleted in line with their corresponding
entry in the database.
We have a plan to introduce incremental database backups, but we are unsure
how we can track the ch... more >>
Change collation from Latin1_General_CI_AS to Latin1_General_CS_AS
Posted by Xavier at 6/18/2007 8:55:01 AM
for a SQL2005 database - the database under extended properties shows
Collation:Latin1_General_CS_AS
For the table under extended properties it is shows also
Collation:Latin1_General_CS_AS
But in the script of the creation of the table it shows
CREATE TABLE [dbo].[MyTable](
[ID] [int] ... more >>
Delete an excel worksheet only if it exists, in a dts package
Posted by rshivaraman NO[at]SPAM gmail.com at 6/18/2007 8:39:32 AM
Hi :
1. I import data into sqlserver, from an excel file, from a worksheet
within it, named 'input_data'
2. then i scrub the data in sqlserver
3. then i export some data into the same excelfile but into another
worksheet named 'output_data'
I have got it working and this is how i am doing ... more >>
Encrypting SQL 2005 database
Posted by Christopher Evans at 6/18/2007 7:27:54 AM
I am looking for sugestions on best peactices for securing a SQL 2005
database from another party that may have access to the physical server,
such as in a server farm.
Any tips are appreciated.
Thanks!
Chris Evans
www.globalmarketmedia.com
*** Sent via Developersdex http://www.develo... more >>
Copy new rows from one table to another
Posted by Rob at 6/18/2007 6:50:01 AM
I have a two tables, A & B, on two separate instances, on the same server. I
have created linked server connections and can query each instance from the
other. Both are test instances.
We are testing a scenario where Table A is fed with daily loads, and using a
SQL command, we'd like to cop... more >>
Using a Case statement and JOINing two tables
Posted by jeanjanssens NO[at]SPAM hotmail.com at 6/18/2007 6:34:33 AM
Hello,
Can someone please help me with an update query?
I have two tables: CUSTOMER and ACCOUNT_SEGMENT
They look as follows:
--------------
CUSTOMER
--------------
CUST_ID =A6BUS_DIV =A6
---------------------------------
0001 =A6PRIV =A6
0002 =A6BUSI =A6
0003 =A6PRIV =A6
00... more >>
user defined data types
Posted by Darin at 6/18/2007 5:27:25 AM
I have created a user-defined data type and added a new column to a
table using that type. In the syscolumns table, the xtype field for that
column is 106. What command can I run to see the type number of my user
defined types?
Darin
*** Sent via Developersdex http://www.developersdex.com *... more >>
Get full initials of a contact
Posted by pj_world_85 NO[at]SPAM hotmail.com at 6/18/2007 4:29:17 AM
Hi,
I have a Contact table that stores the firstname, surname. I am
trying to get the initials of the user in the table and use the sql in
crystal reports.
Let's use 2 users: 'Brian Johnson' and 'Jack Shand-Brown'
For Brian it will be 'BJ' - which is simple enough.
However, how will ... more >>
I need a help on updating a row depending on its created date
Posted by Orgil at 6/18/2007 4:24:27 AM
Hi all,
I'm using MSSQL2000.
I have a "S_Loggeduser" table. This table is for users who logged in a
web site.
The table has "LoggedDate" column. This column is valued by date when
a user logged in the web.
If a user logs out by clicking "Logout" button, a row for this user is
deleted from t... more >>
Calling a stored procedure from a stored procedure and ignoring output from inner procedure call
Posted by Klas_Klättermus at 6/18/2007 12:00:00 AM
Hello there,
I am executing a stored procedure from inside my own procedure. The procedure I am calling returns a resultset and this messes up the resultsets
from my procedure. Is there a way to ignore the output from a stored procedure? (like set nocount on?)
Best... more >>
DDL Trigger
Posted by Rahul at 6/18/2007 12:00:00 AM
Hi,
I want to know about DDL Trigger (Sql Server 2005).
How can I use it, create it, about body of DDL Trigger?
I have serarch some urls, but has not get enough knowledge.
Rahul
... more >>
|