DataSource Controls :: Change File Group Using Alter Table Query?

May 6, 2010

I have a table that contains image data type and has more than 20,000 records.I want to change its file group to the new file group. I tried to change it using table designer, but everytime I wanted to save it, it occured an error with this message:

[Code]....

Does anyone know how to change file group using Alter Table query? I'm using SQL Server 2005.

View 2 Replies


Similar Messages:

DataSource Controls :: Write Alter Schema Query?

Jun 18, 2010

how do i write my alter schema query in Asp.net

using the sqlclient object..

View 3 Replies

DataSource Controls :: Alter Query - Changing A User's Role?

May 9, 2010

I need to change a user's role in my application. Therefore I need to know the correct syntax in code behind to alter a user's role; i.e. string sql = "ALTER TABLE ...etc". I'm not sure how to implement this at all. Is it similar to the INSERT INTO query used in code behind, where we define the parameters etc?

View 2 Replies

DataSource Controls :: Alter Script To Change The Primarykey Column Datatype?

Feb 22, 2010

I am using SQL SERVER 2008 database. I have a table Customers in which the CustomerID column is had datatype INT intially but due to increase in Customers the number range is exceeding which may cause error arithmetic overflow of data. Hence I thought to modify the datatype from INT to BIGINT and wrote an alter script but when I ran the script it failed. Hence provide me in creating alter script for the updating the datatype of the primarykey column for the Customers table.

View 2 Replies

DataSource Controls :: LINQ Query To Grab The Last 5 Rows From A Group?

Jan 8, 2010

i have the following objects:

Event:

- EventID (PK)
- GroupID (FK)
- StartDate

Group:

- GroupID (PK)
- GroupName

What i need to do is select the last 5 events for each group using LINQ to Objects. I tried starting with:

[Code]....

But i'm not sure how i only take the last 5 per group.

The simple way of doing this is to get the groups and then have a property on that which returns the last 5 events but if i databind this i will have to use a nested Repeater/ListView. Ideally i would like to have a row foreach event.

View 3 Replies

DataSource Controls :: Sql Query - Group By - Display Total No Of Contacts And Companies With Respect To Countries

May 4, 2010

i have 2 tables company(companyId,companyName,City,state,country) and people(peopleId,peopleName,City,state,country) i want to display the total no of contacts and Total no of companies with respect to countries

i tried with group by: select country,count(*)companyId from company group by country is displaying the total number of companies with respect to country select country,count(*)peopleId from people group by country is displaying the total number of peoplewith respect to country

but i want to combine these two quries i want the output as :

Country Companies Contacts
India 10 5
USA 0 10 (usa is having only contacts ,i doesn' have the companies)
UK 8 0 (ukis having only companies ,i doesn' have the contacts)

View 2 Replies

DataSource Controls :: Update Query Not Working When Using Query Builder To Configure Table Adapter

Jan 15, 2010

[code]...

This query works perfectly on the query analyser.

But when configuring the Table adapter ,I try executing the query and i get 0 rows affected.

What could I be getting wrong in this case.

NB:Existing GalleryID has been supplied.

View 1 Replies

DataSource Controls :: Change Columns Name After SQL Query ( For Xml Raw)?

Apr 15, 2010

this is my sample script

[Code]....
after execute this script which returns a column name "XML_F52E2B61-18A1...." can I change this column name?like this

select EMPNO AS EmployeeName -- we can use AS to change column name
from EMPLOYEE

View 1 Replies

Access The Group Of A Linq Group - By Query From A Nested Repeater Control?

Mar 26, 2010

I'm using a linq group by query (with two grouping parameters) and would like to use the resulting data in a nested repeater.

var dateGroups = from row in data.AsEnumerable()
group row by new { StartDate = row["StartDate"], EndDate = row["EndDate"] };
"data" is a DataTable from an SqlDataAdapter-filled DataSet. "dateGroups" is used in the parent repeater, and I can access the group keys using Eval("key.StartDate") and Eval("key.EndDate").

Since dateGroups actually contains all the data rows grouped neatly by Start/End date, I'd like to access those rows to display the data in a child repeater. To what would I set the child repeater's DataSource? I have tried every expression in markup I could think of; I think the problem is that I'm trying to access an anonymous member (and I don't know how.) In case it doesn't turn out to be obvious, what would be the expression to access the elements in each iteration of the child repeater? Is there an expression that would let me set the DataSource in the markup, or will it have to be in the codebehind on some event in the parent repeater?

View 3 Replies

DataSource Controls :: How To Alter A Check Constraint

Jan 6, 2010

Here I have specified a query which gives an idea about how to drop a constraint and recrate it..

[Code]....

Parent_TableName: is the name of the table where we actually reffer.

View 1 Replies

DataSource Controls :: How To Merge Two Table Based On SQL Query

Jun 7, 2010

This is my table stucture...

This is first table...

ItemNo refno Process Name Qty
001 1 A John 50
001 2 A Jon 150
002 3 B
Kalis 100
003 4 A
Bob 300
Second Table
ItemNo Newrefno Process Name Qty
001 001 ZZ peter 50
001 001/a ZkZ Joe 70
002 002 Ab Ray 100
Result Set
001 A John 200 001/a ZZ ZkZ peter joe 50 70
002 B
Kalis 100 002 Ab Null Ray Null 100 Null
003 A
Bob 300 null null null null null null null

Here first row of the result set explanation:

up to this 001 A John 200 based on first table sum...

and 001/a zz ZkZ peter joe 50 70

here 001/a newrefno of 001 so i need to show all the ItemNo 001 record in one row like the above resultset.

View 4 Replies

DataSource Controls :: How To Alter Dataset Once Bound To A Datarelations

Jun 22, 2010

I have the following code that I wasnt to alter the Dataset before it is bound to the dropdown list.

[Code]....

What I would like to do is ALTER the dataset for the Parent (dropdown list - ddlRT). I need to format and disable certain topics. I have a script I create before I added the datarelations.

View 1 Replies

DataSource Controls :: Bulk Update A Temp Table With The Sum Of Another Query?

May 17, 2010

how to bulk update a temp table with the sum of another query. for example

update @temp
Set total =
(
select sum(bedstays)
from @temp2
WHERE @temp2.ID = @temp.ID
)

i keep getting error in sub query on the @temp.ID saying i need to declare @temp and when i alias @temp "@temp t" i get an incorrect syntax near "t".

View 2 Replies

DataSource Controls :: Entity Query To Validate Ntry Not Already In A Table

Jun 16, 2010

I have a button click event that adds a record to a table based on the userid and threadid the user is viewing. I am a bit new to entity so I am stumbling around. I have to where conditions

ThreadID == threadid
UserId == userIdPosts

I have this query but do not know how to execute it and if I have it as is I get this in the yellow screen of death Both the theadid and userIdPosts have data in them.

var query = context.TrackLists.First(t => t.ThreadID == threadid);
context.TrackLists.First(t => t.UserId == userIdPosts);

Sequence contains no elements

Line 90: // find is user has already tracked this thread.
Line 91: var query = context.TrackLists.First(t => t.ThreadID == threadid);
Line 92: context.TrackLists.First(t => t.UserId == userIdPosts);

View 3 Replies

DataSource Controls :: How To Get Query To Return Values From Xml Column In Table

Jun 24, 2010

I am trying to do a lookup in a table with a value stored in an xml column.

I tried this several ways but I can't get it to work.

Here is some code:

[Code]....

View 1 Replies

DataSource Controls :: SqlDataSource Query Not Using Index On Database Table?

Jan 20, 2011

I have this sqldatasource:

<asp:sqldatasource id="SqlDataSourceX" runat="server" connectionstring="<%$ ConnectionStrings:MyConn%>" providername="System.Data.SqlClient"
selectcommand="SELECT ItemNum, MIN(DateAdded) as [DateAdded]
FROM Items WITH (NOLOCK)
WHERE [DateAdded] between @DateFrom AND @DateTo

[Code]....

When I call select in codebehind, after 30sec it throws timeout expired SqlException:

[Code]....

again , this select took up to 3 sec to be executed. In application I tried to use SqlConnection and SqlTableAdapter instead of SqlDataSource, with the same query, and again it took up to 3 sec.

If I choose tighter interval (e.g '2011-01-20 00:00:00' - '2011-01-21 00:00:00') , there is no timeout exception, so I know that sqldatasource select is executed correctly. So the conclusion is that sql server is not using index while executing query sent from sqldatasource, but is using index whenever else. I have also checked the index statistics on sql server and it is like that. In profiler i can see slight difference between this two cases. As for SqlDataSource, in events table, in first column "EventClass" after 30 sec, there is this: "RPC:Completed" and application throws timeout. If i use SqlConnection and SqlTableAdapter then at the same place there is this: "SQL:BatchStarting" and "SQL:BatchCompleted" and application does not throws timeout(the index has been used).

what is so special on SqlDataSource connection, that Sql Server performs differently compared to other types of connections?

View 3 Replies

DataSource Controls :: Unable To Alter Connection Timout Property?

Feb 22, 2010

Im using two stored procedures to write and update values in a SQL DB. Im using the SQLDatasource update method. When I run the webpage on my development server everything runs fine. When I try and run the web page on my Live server I get the following error :System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding This always takes 30 seconds to fail - and looking at google it seems that this is a connection timeout error.In my web.config file I have updated the connectionstring line to include a timeout setting :

connectionString="Data Source=myserver;Initial Catalog=ReportServer;Integrated Security=True;Connect
Timeout=10000"

But this hasn't helped at all.

View 3 Replies

DataSource Controls :: Update Table Field With LINQ To SQL And Query String

Jul 11, 2010

I am trying to update my table ARTICLES and it has a field COUNTER, Everytime a user enter this ARTICLES, the page_load event runs a LINQ to SQL query taking the QueryString as parameter, increasing the COUNTER field in 1.

[Code]....

View 2 Replies

DataSource Controls :: Unable To Change The Structure Of Table?

May 14, 2010

I have one table in database in which millions or records exest already. I can't change the structure of table. And i have to create 4 store procedure each of them will fetch 100 records from this table. And they will keep going on. But condition is that they should not fetch same row. how can all store procedure fetch uniqe data from table.

View 4 Replies

DataSource Controls :: How To Query A Table That Contains An XML Column And Bind The Data To A Gridview Object

Jun 21, 2010

I have tried to query a table with an xml column by using XQuery and I can't get the Select to work.

All my knowledge/understanding of the subject comes from this MSDN article:

[URL]

so I am probably overlooking something minor:

I tried this query Select col1, Phone.Query('element CellPhone {I am not sure about what goes here} I tried {data('Phone/cellPhone} from aTable Where Phone.Exist('/Phone/cellPhone/text()[contains.,"412-8977"]') = 1 This syntax is definitely not fun.

View 2 Replies

DataSource Controls :: Write The Query For Finding Second Highest Salary In Employee Table?

May 2, 2010

I want to write the query for finding second highest salary in my employee table how to find it??

View 3 Replies

DataSource Controls :: How To Change A Table Column Data Type

Jan 21, 2010

I attempted to change a table columns data type and in the process caused a lot of issues. I had a date column in one of my tables and stupidly changed it from varchar to date. When I tried to run queries on it I keep getting the 'cant find column 3 error'. Now that tables structure is :

[Code]...

So column 4 is actually the date column. All other queries work for this table. I then tried to change it back and then copied all data to a new table and now I am using the new table and converting the dates as needed but I am still getting the error.

SELECT * FROM postlinks WHERE postlinks.date >= CONVERT(datetime,CONVERT(varchar(10),GetDate(),112))

View 16 Replies

DataSource Controls :: Implementing A BLL / Contacts Table, The Select Method Is A Sql Query Against A Sql Server 2000 Database?

Feb 17, 2010

I'm implementing a BLL layer and have a few questions. First, in my DAL, there is a contacts table, the select method is a sql query against a sql server 2000 database. The preview data returns everyting as expected. The query is

[Code]....

The BLL method is built like so

[Code]....

When using the BLL method to a gridview, the results of the subquery are not displayed. There are also other methods, each having a different where clause for ContactRole_ID and each is having the same issue of not displaying the subquery reult in the gridview. No error, but no data is displayed for the subquery either. Here is the templatefield of the gridview

[Code]....

Another item that is causing an error is in trying to update a record. Here is the DAL update method

[Code]....

And the BLL update method

[Code]....

The error says i have extra parameters, but have no clue where the extra parameters are being picked up. The error isObjectDataSource 'odsContacts' could not find a non-generic method 'UpdateContact' that has parameters: _ContactID, _Active, _ContactName, _Office, _VirtualOffice, _Pager, _Fax, _Home, _Cellular, _Email, _ContactRole_ID, Active, ContactRole_ID, ContactName, Office, Email, VirtualOffice, Pager, FAX, Home, Cellular.And the objectdatasource

[Code]....

View 4 Replies

DataSource Controls :: How To Get Sql Query Output In Text File

May 31, 2010

how to get sql query output in text file?

View 1 Replies

ADO.NET :: How To Execute Alter Table For Multiple Columns

Oct 24, 2010

I have an SQL table called tbl, im trying to add the columns A, B and C to it.

When i execute the command :

addcolumns = "ALTER TABLE SqlCreatedTbl ADD A char(50) ;";
cmd = new SqlCommand(addcolumns, conn);
conn.Open(); cmd.ExecuteNonQuery();

The column is added perfectly and i can see it in the table !

However, when i try to add multiple columns, it does NOT work, it gives me an error..

the command im writting for adding multiple columns is the following:

addcolumns = "ALTER TABLE SqlCreatedTbl ADD ( A char(50), B char(50), C char(50) );";

the debugger highlights the line : cmd.ExecuteNonQuery(); and throws the following exception: Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near '('.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved