|
Lijo Rajan wrote: How can i get all tables in MS Acess to sql server 2005?
Did you try searching Google? I did and found this link[^] at the top of the list.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi
i have one table
-------------------------------------------------------------------------
Analyst security Stock User Assign Status Updated Updated
code(pk) code Name Id Date Code By Date
-------------------------------------------------------------------------
1 500103 HDFC PatelAmi Jul 20 2007 A - - 2 500410 ATC Ltd Shah Vis nov 01 2007 A - -
-------------------------------------------------------------------------
In my Project my first query is
update tAnalystAssignHistory set StatusCode ='C'where
UserId ='PatelAmi' and StockName='HDFC LTD'
in this query status code will update.
i want 2nd query is like ===
I want to INSERT same 1st record in new row But i didnt have any control for inserting record .Only i have StockName,UserId,UpdatedBy,UpdatedDate
that valus i will be insert other are same to same 1st record.so how can i write it.
pls help me
its urgent.
Gayatri
|
|
|
|
|
table --
-------------------------------------------------------------------------
Analyst.|security |Stock.|User.....|Assign.....|Status|Updated|Updated|
code(pk)|code.....|Name..|Id.......|Date.......|Code..|By.....|Date..|
-------------------------------------------------------------------------
1.......|500103...|HDFC..|PatelAm..|Jul.20.2007|..A...|...-...|..-...|
2.......|500410...|ATCLtd|Shah Vis.|Nov.01.2007|..A...|...-...|..-...|
Gayatri
|
|
|
|
|
hello pls give me a reply
Gayatri
|
|
|
|
|
Hi i have table of the record 1000 and want to to show the record in 4 different column means that 250 record in first column and 250 record in second and then after that 250 in third and 250 in fourth how i can do this
wasim khan
|
|
|
|
|
First of all, use more meaningful names for your posts. 'plz tell me how' doesn't give any indication what your question is. Read the forum guidelines.
In answer to your question, write four subqueries to fetch the rows in each range. For each subquery, use the ROW_NUMBER function to assign a number to each row and select the rows within the required range.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Please pick a more meaningful topic and rephrase your question.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi
can any one tell me how to encrypt a password! What logic should i use
thanks
kssk
|
|
|
|
|
If this is a C# question, why didn't you post it in the C# forum? Your question has nothing to do with SQL.
If you are using .NET 2.0 or above, have a look at the Membership[^] provider. It provides a framework for role-based security which includes functionality for password hashing/encryption using the MD5 and SHA1 algorithms.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
like this, in a loop, n is from 1 to 1000
<br />
UPDATE t1 set a=calc_heavily where id=n<br />
UPDATE t1 set b=a where id=n<br />
The problem is that, the second UPDATE fails sometimes. Is there a sync problem? How make it successful everytime.
|
|
|
|
|
When you say it fails, do you get any error messages?
Have you tried transactions?
|
|
|
|
|
How about:
<br />
UPDATE t1 set a=calc_heavily, b=a <br />
where id=n<br />
Regards
Guy
You always pass failure on the way to success.
|
|
|
|
|
Hi all,
I'm currently doing a contract and supplier system, using VB.net and MSSQL.
I have this table (Contract) containing the following fields:
Contract_ID INT NOT NULL,<br />
Vendor_ID INT NOT NULL,<br />
ContractDate datetime,<br />
DateStart datetime,<br />
DateDue datetime,<br />
PRIMARY KEY(Contract_ID),<br />
FOREIGN KEY (Vendor_ID) REFERENCES Vendor(Vendor_ID)
1) I am going to do something like select contracts up for renewal in X months, eg in 3 months. (the syntax is one thing i'm not sure)
2) But the datetime format for both VB.net and MSSQL are different as shown below. (the format differs would matter too much? cos in the end, we are still proceeding with sql datetime format code.)
http://i5.tinypic.com/7xaeo95.jpg
http://i4.tinypic.com/739s66g.jpg
3) Do I put the codes in vb form or in vb's stored procedures?
I think it is something like this: http://www.outlookcode.com/d/code/remindbday.htm
But I have no idea how to start.
I hope the info I gave are not too vague. Any help is appreciated. Thanks.
|
|
|
|
|
you can do it in Stored Procedure, use the convert function, then where clause to serve the purpose. something like
set @Date = CAST(DATEPART(YEAR, @Date) as varchar) + '-' + CAST(DATEPART(MONTH, @Date) as varchar)+ '-' + CAST(DATEPART(DAY, @Date) as varchar) + ' 00:00:00'
|
|
|
|
|
Hi,
thanks for the reply. Regarding stored procedure, what would I need to do to show the contracts up for renewal?
But if you don't mind can you explain what the code does? What would be the @Date ?? Why is it plus-ing? Sorry, I quite a beginner for database.
telly
|
|
|
|
|
@Date is your parameter @DateStart, convert the Dateformat, so that you can strip it out and select which ever datepart you want, like year, month, days. the concatination separates the date part, to be able to easily select
like select contractID from XXX
where @DateStart between 01-10-2007 to 03-12-2007
hope you get this time..
|
|
|
|
|
hi...
plz somone help me write these queries..
i want to search the data's from employee select the employee name,designation_name
where
1)employee code that i can pass or else designation name i can pass
2)only one i can pass from theses 2
3)the employee can contain null value for desination name
4)constraint is :employee.designation_id=desig.designation_id
plz somone help me out to solve this pblm
|
|
|
|
|
What part of your code are you specifically having difficulties with? At the moment, it sounds like you want someone to do your work for you.
You haven't stated what database you are you using. However if it is SQL Server, I suggest you do some research on writing stored procedures to encapsulate the logic for your search.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
For SQL-Server:
select employee.name, designation.name
from employee
left outer join designation
on designation.designation_id = employee.designation_id
where employee.code = IsNull(@EmployeeCode, employee.code)
and IsNull(designation.name, '') = IsNull(@DesignationName, designation.name)
order by employee.name The outer join links the two tables together - even if there is no designation.
The IsNull bit allows you to optionally pass in a NULL or a proper value for the employee code and the designation.
Hope that helps.
Andy
|
|
|
|
|
I have these (amongst others) tables in my database:
Tasks and Successors
Tasks hold details about task, and Successors has two taskIDs as forgien keys (jointly primary key) to hold data on the relationship between task.
Ie Task A has Tasks B and C as successors.
Task Table has three records for the task. The Successor table has TaskA/B and TaskA/C primary key feilds.
I'm using this on a C# Clone of MS Project. So I'm reading this data in and converting them into classes, in a tree structure so each Task Object has a List<task> of successors.
I can read this data in fine by just parsing the data in the tables. The problem comes when I want to put newly created data into the database, which is stored in this tree of instances of Task.
[b]If I put add a Task record into the database, how do I get the primary key of the one I've just put in so that I can create the records in the successor table to link them?[/b]
In my example I will probably have to added the tasks 1st so that when I add the successor records, the tasks actually exists. The algorithim for this will be quite simple if I was able to get the primary keys when I adding the tasks.
Anyone have any idea on how to do this?
Thanks for any help,
Ian.
|
|
|
|
|
If you are using SQL Server, use SELECT ... = SCOPE_IDENTITY() after your insert statement.
|
|
|
|
|
|
Here is the table
Project col1 col2 col3 col4
A 151,46 80 0,29 2
A 529,14 83 0,29 1
B 3391,3 80 0 2
B 3706,2 75 0,06 1
C 8685,3 78 2,41 1
C 9005,2 71 0 2
How do I get the max value for col1 for each project and its other values?
ie. project a's max value is 529,14. its others value is 80, 0.29 and 2
Project col1 col2 col3 col4
A 529,14 83 0,29 1
B 3706,2 75 0,06 1
C 9005,2 71 0 2
I have this query, but it results everything, not only the max value for each project
select project, max(col1), col2, col3, col4 from out_pumptable group by project, col2, col3, col4
|
|
|
|
|
Try
SELECT g.Maximum, * from Projects, (SELECT MAX(col1) as Maximum FROM projects GROUP BY project)g WHERE MAX(col1) = g.Maximum
|
|
|
|
|
it looks good, but the column project you have after group by isnt used anywhere. is it something missing before group by?
never mind about that.
I have tried the query and it results a little too much. it seems it loops for each max value and result for all row
|
|
|
|