For some reason it takes 7 seconds to open a connection to a sql server database for the firt time, subsequent connections takes a second. any idea what could be the reason?
I'm using C# and asp.net
Its after compilation, i essence every time i restart the site, which means every time it needs to actualy create the "first" connection. i understand that setting up connection pooling has overhead, but i have never seen that i should take 7 second to set it up.
I have a stored procedure that alters user data in a certain way. I pass it user_id and it does it's thing. I want to run a query on a table and then for each user_id I find run the stored procedure once on that user_id
How would I write query for this?
SQL SERVER
Good Morning,
I have connected to my SQL 2005 server - and have managed to list all of the databases on that server. Now I would like to run a check on each database to see if I have permission to view that database..
How would I go about this?
Many Thanks,
Joel
Hi,
I have a MS SQL query that is selecting a field and it is being chopped off for some reason it is cutting off text at 257 characters.
Is there some kind of default cut-off for retrieving results with MSSQL and PHP?
I'm honestly clueless as to why this is happening. ANY guidance would be greatly appreciated
Why does SQL server 2008 always warn about needing to drop tables to rename columns? I was under impression this was not required unless it was a key. If I change a column from null to not null even if is not a key field it wants to drop table and all relations.
Say we have a table
table posts
+---------+-----------+--------------------------------+
| postId | title | status | bodyText |
+---------+-----------+--------------------------------+
| 1 | Hello! | deleted | A deleted post! |
| 2 | Hello 2! | deleted | Another one! |
Can we, in SQL, retrieve a concatenation of a field across rows, by issuing a single query, not having to do the join up in a loop in our back-end code?
Something like
select title from posts group by status ;
Should give "Hello!, Hello 2!"
Hello Everyone,
I want to apply a update trigger on a table in SQL server 2000. Trigger should update .XML file present on another server. I have full access to both servers.
I am unable to figure how to do it, please help me out.
With respect to an application that has both a web and desktop client version:
What is the best practice for the desktop client which needs access to a SQL Server?
What are the benefits of connecting to the database from the application vs using a web service?
Which one provides better security?
What type of scope would call for one vs the other (enterprise intranet vs. web app, etc)
Are there any other considerations that are necessary when choosing on platform?
I have project which contain 4 tables among these shedule table Session column i am not able to add vaue,,this table contain
three foriegn key from two tables(in which single table has two foreign keys here) i added values here..Any one
has any idea about this..Actually my intention is to remove the error "the insert statement conflicted with the foreign key constraint sql server"
I have a SQL table (MYSQL 4.0 to be precise) composed of the following :
int no (primary)
int field1
int field2
I would like to swap the values of field1 with the values of field2 and vice-versa.
Ex.: 1;2.5;3.76 becomes 1;3.76;2.5
I need a swapping temporary variable of some sort. But I don't think I can use something like
Set @var1 = field1
inside my update statement. And I don't think altering the table to add a temporary column is my best best either.
Can anyone recommend a tutorial on how to write a java servlet which connects to ms sql server and manages data?
I'm trying to write something which pulls products out of one database and inserts them into a stored procedure located on another database.
thanks in advance
I am trying to set the default value for a new column I just added. In properties I am trying to set 'Default Value or Binding' to a simple XML along the lines of: <root><title>Welcome</title><body>Thank you for your time.</body></root>
However, when I click away, I get "sql error validating the default for column," I set this value in other numerical columns and it worked fine. What gives?
i am creating windows application .In this i have to subtract two dates .i subtract it successfully ,i used TimeSpan to get subtracted value.But when i insert it in SQl Server 2005 db, it inserted with starting date i.e. 1/1/1900 and the calculated difference
which format should i use to insert Time only?
Thanks in advance
See the following SQL statement:
SELECT datediff("d", MAX(invoice.date), Now) As Date_Diff, MAX(invoice.date) AS max_invoice_date, customer.number AS customer_number
FROM invoice INNER JOIN customer ON invoice.customer_number = customer.number
GROUP BY customer.number
If the the following was added:
HAVING datediff("d", MAX(invoice.date), Now) > 365
would this simply exclude rows with Date_Diff <= 365?
What should be the effect of the HAVING clause here?
Hi everyone,
Im writing a C# web page thats tied to a listview. My lcient would like to eb able to type in something or part of something that it would show results. For example he wants a textbox where he may put in a phone number, part of a phone number, a name, city or whatever and there would be a SP of sorts that finds then lists the info. How can I accompish this in either a SQL Sp or within VS 2010?
In the JDBC code, I have the following that is working with SQL Server:
CallableStatement stmt = connection.prepareCall("{ call getName() }");
ResultSet rs = stmt.executeQuery();
if(rs != null)
{
while(rs.next())
{
//do something with rs.getString("name")
}
}
Multiple rows are returned for the above situation.
I understand that the use of a cursor is required to loop through the table in Oracle, but is there any way to keep the above code the same and accomplish the same thing?
Thanks in advance.
Hi, I need to change the database name in SQL SERVER 2008 and use it in another project. However it consist hundreds of stored procedures and the name of the database should be changed in the stored procedures as well. Is there any way to do this?
update p
set
p.storePrice =
CASE
WHEN
p.costPrice BETWEEN 0.00 AND 1.00
THEN p.costPrice * 1.0
CASE
WHEN
p.costPrice BETWEEN 0.00 AND 1.00
THEN p.costPrice * 1.0
ELSE
p.msrpPrice
END
FROM product p
WHERE p.type = 1
The error says:
Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'CASE'.
I can't seem to see any issue with the sql?
Hi,
I had asked this question
http://stackoverflow.com/questions/2442149/adding-more-attributes-to-linq-to-sql-entity
Now, when I add Browsable attribute to generated entity in designer,it works.But,when I use the MetaDataType approach,and add Browsable attribute in partial class,it does not work
"I added a MetaDataType class, and added browsable attribute to property,but seems to have no effect"
Hi,
from front end application I am sending the value as 0.15 to database via a stored procedure, but it gets stored as 0 value. Why? please guide. I am using C# + ASP.NET + SQL Server 2008
Hi All,
According to the following section of BOL:
How to: Use Source Control with SQL Server Management Studio
If you have a source control client installed you should be able to choose it in the plug-in selection. I have both source control clients for Visual Studio 2005 and 2008 (tfs2005) installed and there's no plug-in to choose in the list for me.