|
I haven't tried that yet. I will and let you know. Thnks.
|
|
|
|
|
do simple job, take backup of your database and create a new db on your new pc with the same name and restore the file you have taken by backup.
rmshah
Developer
|
|
|
|
|
I did recreate a new database in ACCESS and was finally able to copy my tables of data from SQL to it. Thanks for the advice.
|
|
|
|
|
Hi all,
I am trying to bulk insert a Csv file from an FTP site to a table in SQL2005.Can any one advice me on how to do it using SQl server integration services.(SSIS package)
I havent used this before ,however i have seen an FTP task on the tool box.
Your views are much appreciated.
Thank you
|
|
|
|
|
Please don't cross post. It's rude. Read the forum rules.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi All,
I've just started looking at LINQ and it seems cool 'n all but for getting data into a DataSet / DataTable I seem to have defaulted back to plain old .NET DataAdaptors and issuing normal "SELECT * FROM ... " commands.
I was doing this:
DataContext dc = new DataContext(conn);
Table<TableName> tablename = dc.GetTable<TableName>();
I read some online samples (that were referencing System.Query which I can't find!) and they were creating plain .NET tables (i need this for databinding to in a UI) by using .ToDataTable(); which seems to be a really handy command that doesn't appear in my intellisense.
What's the easiest route from a LINQ Table<TableName> to a plain old .NET DataTable ?
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Funnily enough, I answered this same question in a Blog a while back. You can find the answer here[^].
|
|
|
|
|
Fantastic!! Thanks chap.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
No bother mate. Glad to help.
|
|
|
|
|
Hi all,
I am confused in choosing between a View and a table-valued UDF and looking for your suggestions. Here is what I want to do.
Select
Column1, Column2, .. ColumnN
From
Table1
Inner Join Table2 on SomeColumns
Inner Join Table3 on SomeColumns
..
Inner Join TableN on SomeColumns
Where
Condition1 ..... Condition N
Of course, I will be consuming this view/UDF in my queries later.
Please note that I have no specific parameters for this query, nor have I any security requirements. I just want to know which one gives better performance. Ideas
Thanks,
Mehroz
|
|
|
|
|
Good Morning All
u have the Following Query that Display me the records.
select ps.Lis_key as [Celeste],p.Lis_key as [Pro-v],<br />
p.Attrib_code,p.Func_key from dbo.Check_LIS ps<br />
inner join Tshwane_Valuations.sde.Property p <br />
on ps.Lis_key = p.Lis_key<br />
where ps.Lis_key = p.Lis_key And <br />
Substring(p.Attrib_code,5,2)='16'<br />
OR p.Attrib_code = '0009000900'
so i want Delete the records returned by this Query. please Explain how you do it when you give me a code.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Why don't you try this:
delete from dbo.Check_LIS
where Lis_key in(
select ps.Lis_key
from dbo.Check_LIS as ps inner join Tshwane_Valuations.sde.Property as p
on ps.Lis_key = p.Lis_key
where substring (p.Attrib_code, 5, 2) = '16'
or p.Attrib_code = '0009000900'
)
Also you don't need to add ps.Lis_key = p.Lis_key in the where clause since you use inner join on the same fields.
I hope this was helpful.
Best wishes,
Dobromir.
|
|
|
|
|
Thanks man
it was very easy
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hello,
I'd like some help on the following problem - I need to use an alias as a condition in the where clause:
select field1,
field2,
field3,
field1*field2-field3 as some_alias
from table1
where some_alias between 10 and 20
Using an alias like that returns the following error:
Invalid column name 'some_alias'.
Could anyone propose a solution?
|
|
|
|
|
Hi Dobromir,
You can use the alias definition in the where clause. Here is your query modified:
select field1,
field2,
field3,
field1*field2-field3 as some_alias
from table1
where (field1*field2-field3) between 10 and 20
Regards,
Mehroz
|
|
|
|
|
thank you for your answer, but is'n this going to cause a recalculation of the value of the alias?
|
|
|
|
|
Hello. I have the following problem:I need to retreive top(N)rows for each group in a single query. Here is an example of what I would like to do:
select top(10) with ties
table1.field1,
table1.field2,
table2.field1
from table1 inner join table2 on table1.some_field = table2.same_field
group by table1.field1
order by table1.field1
As you can see, this query will return only 10 rows. What I need is 10 rows for each group (table1.field1).
Can anyone help?
|
|
|
|
|
Try something like this:
SELECT
t1.Field1,
t1.Field2,
t2.Field3
FROM Table1 t1
JOIN Table2 t2 ON t2.JoinField = t1.JoinField
WHERE
t2.IdField IN
(
SELECT TOP(10)
t3.IdField
FROM Table2 t3
WHERE
t3.JoinField = t2.JoinField
ORDER BY
t3.IdField DESC
)
It is called a correlated subquery.
|
|
|
|
|
Hi,
Anyboby can give me real scenario example how to use indexing on the table.
Requirement:
example in MS-SQL.
Thanks
|
|
|
|
|
Please define your question better. What do you want to do, create an index (try BOL) or decide on what column(s) should be in the index?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
GM
first of all thanx for replying.
mine queries are
-how to create index
-in which field it should be
-explain me this concept in example
thanks
Ashish
|
|
|
|
|
You are having a laugh aren't you? Can I collect whatever qualification is is you are trying for?
Ashish Kumar Vyas wrote: how to create index
Try BOOKS ON LINE, thats what they are for
Ashish Kumar Vyas wrote: in which field it should be
Rather dependant on the table, usage etc etc
Ashish Kumar Vyas wrote: explain me this concept in example
Where do you start? I know, google!
just to show I'm not all bad:
CREATE INDEX index_name ON table(column,column....)
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Create a Database
To create a database:
CREATE DATABASE database_name<br />
Create a Table
To create a table in a database:
CREATE TABLE table_name<br />
(<br />
column_name1 data_type,<br />
column_name2 data_type,<br />
.......<br />
)<br />
Example
This example demonstrates how you can create a table named "Person", with four columns. The column names will be "LastName", "FirstName", "Address", and "Age":
CREATE TABLE Person <br />
(<br />
LastName varchar,<br />
FirstName varchar,<br />
Address varchar,<br />
Age int<br />
)
This example demonstrates how you can specify a maximum length for some columns:
CREATE TABLE Person <br />
(<br />
LastName varchar(30),<br />
FirstName varchar,<br />
Address varchar,<br />
Age int(3) <br />
)
The data type specifies what type of data the column can hold. The table below contains the most common data types in SQL:
Data Type Description
integer(size)
int(size)
smallint(size)
tinyint(size) Hold integers only. The maximum number of digits are specified in parenthesis.
decimal(size,d)
numeric(size,d) Hold numbers with fractions. The maximum number of digits are specified in "size". The maximum number of digits to the right of the decimal is specified in "d".
char(size) Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis.
varchar(size) Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis.
date(yyyymmdd) Holds a date
Create Index
Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries.
Note: Updating a table containing indexes takes more time than updating a table without, this is because the indexes also need an update. So, it is a good idea to create indexes only on columns that are often used for a search.
A Unique Index
Creates a unique index on a table. A unique index means that two rows cannot have the same index value.
CREATE UNIQUE INDEX index_name
ON table_name (column_name)
The "column_name" specifies the column you want indexed.
A Simple Index
Creates a simple index on a table. When the UNIQUE keyword is omitted, duplicate values are allowed.
CREATE INDEX index_name<br />
ON table_name (column_name)<br />
The "column_name" specifies the column you want indexed.
Example
This example creates a simple index, named "PersonIndex", on the LastName field of the Person table:
<br />
CREATE INDEX PersonIndex<br />
ON Person (LastName)
If you want to index the values in a column in descending order, you can add the reserved word DESC after the column name:
<br />
CREATE INDEX PersonIndex<br />
ON Person (LastName DESC)
If you want to index more than one column you can list the column names within the parentheses, separated by commas:
CREATE INDEX PersonIndex<br />
ON Person (LastName, FirstName)<br />
|
|
|
|
|
Hi
I want to create a sql query which meet following criteria but i can't understand how can i write this. I tried a lot but did not successed.
My table structure is as follow.
ATA_Question.
Qid -- Catid -- Subcatid -- SortOrder -- Question --
1 1 1 1 question.
Suppose the table contain 30 question having catid=1 and sort number varies between 1 to 9. Now i want to show the first top 12 question which having catid=1 and sort order in ascending.
If Question 30 having sort order 1 and catid=1 then my query return top 12 question which having sort order in ascending. First it show question having sort order 1 then next sort order 2 and so on and return top 12 question.
How can i write the query for this. Please help me?
I have solved that one
Regards
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
modified on Wednesday, March 26, 2008 2:36 AM
|
|
|
|
|
rahul.net11 wrote: I have solved that one
So, have you solved your problem or not?
If you have, you should modify your post title to indicate the problem is solved and post your solution. Otherwise people will waste their time trying to help you find a solution you have already got.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|