What's the best way to determine if a given SQLServer table is readonly, either because of account permissions or the database being marked as read-only?
I am in the middle of designing a highly-scalable application which must store a lot of data. Just for example it will store lots about users and then things like a lot of their messages, comments etc. I have always used MySQL before but now I am minded to try something new like couchdb or similar which is not SQL.
Does anyone have any thoughts or guidance on this?
I am very new to SQLServer Stored Procedures,
I am trying to create a SP that will give return a list of records in a table by filter via StartDate and EndDate , but there will be 'View All' Option so sometime those @Param might not contain any values.
Currently my SP is Like
CREATE PROCEDURE [dbo].[spGetBonusRun]
(
@StartDate as DATETIME,
@EndDate as DATETIME
)
AS
SELECT [Id]
,[StartDateTime]
,[EndDate]
,[Status]
FROM [Valt].[dbo].[BonusRun]
WHERE StartDateTime <= @StartDate AND EndDate >= @EndDate
How to active that ?
Hi
I am getting
Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Data.SqlClient.SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
When I run the SAME query in the SQL query program I get result within seconds, and in LINQ it takes forever and fails.
What can cause this???
Thanks!
I am developing a web Application in ASP.NET 3.5 with SQLServer 2008. I need Multiple Language such as English, Dutch, Finnish etc. I can do it by using System.Resources and System.Globalization. but I can't convert the Language which data come from database.
How can I solve it ???
I am messing around with one of my databases.. is there away for me to search for a string in ALL the tables.. and replace it with another everywhere it occurs?
I am looking for SQL
Hi,
While working with DB, I find useful using some tools, that help me to solve DB problems.
Some of them are:
1) Insert generator
2) A tool that can execute a script on a list of DB's
3) Finding a text in stored procedures and functions.
4) DB Back up scripts
My question is, what are most useful tools, scripts(anything else), that help you to work with MS SQL?
Thanks in advance.
Hello,
I'm trying to build a facebook like search for my software.
I'd like to query the table customers.
I've set up a FULLTEXT Index and tried the next query
SELECT * FROM Customer where CONTAINS(*,'*ann*')
The query does return all the customers named Ann, but it doesn't return all the customers name Anne.
Is there a way to create prefix search on SQLSERVER 2008 using FTS?
Thanks.
Hi,
I am using SQLserver 2008 express and some of our columns are defined as varchar(255). Should I convert these columns to NvarChar(255) or nvarchar(max)?
The reason I ask is I read that nvarchar(255) for unicode characters would actually store 1/2 the number of characters (since unicode characters are 2 bytes) whereas 255 with varchar() would allow me to store 255 characters (or is it 255 - 2 for the offset).
Would there be any performance hits using nvarchar(max)?
JDs
Quick question playing with PL SQL it seems that the tables column was named as the data type NUMBER so trying to perform a query fails since the column is being recognized as a datatype instead of a column name. Anyone know how to get around this without modifying the schema?
Hi
I have tried uploading a transparent PNG image to a SQLserver image field, and retrieving it using the DynamicData ImageHandler. The Transparent areas in the image appear white upon rendering. Please advise about any solutions
I have re-written my code after great help from some friendly stack overflow members (big thanks to Martin B and Kev Chadders especially). I would now like to check if my code is still open to SQL Injections after this work. I believe the code is now working as it should, but any blinding errors that you see i'd love to hear about too. My code is now looking like:
-code removed-
I'm considering using PostgreSQL with a .Net web app. Basically 3 reasons:
Mature Geo Queries
Small footprint + Linux
Price
I'm wondering a bit about tools though, SQLServer Profiler and query plans and performance monitors have been helpful. How is this world with Postgres? Some other things I should consider?
Edit: Will most likely use NHibernate as ORM
Hi, I'm trying to create a table type in sqlserver 2005.
Here is what my code looks like:
CREATE TYPE NameResourceType AS TABLE
(
ID int,
[Value] Varchar(256)
)
GO
I receive the following error:
Incorrect syntax near the keyword 'AS'.
hi there,
I'm using MS SqlServer and I want to use identity constraint in it
I know how to use it in following manner
create table mytable
(
c1 int primary key identity(1,1);
)
the above code works fine but what if i want the identity column to have values as EMP001, EMP002,... instead of 1,2....
Thanks in advance,
Guru
Please help me with writing a sql query - I have a table with id, name and marks columns.
If I arrange the table in ascending order of marks, how can I fetch 5 names whose marks are close to a particular name.
If I have an UDF that returns a table, with thousands of rows, but I just want a particular row from that rowset, will SQLServer be able to handle this effciently?
SELECT * FROM dbo.MyTableUDF()
WHERE ID = 1
To what extent is the query optimizer capable of reasoning about this type of query?
How are Table-Valued UDFs different from traidtional views if they take no parameters?
Any gotchas I should know about?
Hi Team,
Could you please list some of the bad practices in SQL, that novice people do?
I have found the use of "WHILE loop" in scenarios which could be resolved using set operations.
Another example is inserting data only if it does not exist. This can be achieved using LEFT OUTER JOIN. Some people go for "IF"
Any other thoughts?
Thanks
Lijo
I have this function I'm using and I want to be sure that it fully protects against SQL injection attacks:
function MakeSafeForQuery($string)
{
// replace all of the quote
// chars by their escape sequence
$ret = str_replace("\\","\\\\",$string);
$ret = str_replace("'","\\'",$ret);
$ret = str_replace("\"","\\\"",$ret);
return $ret;
}
Am I missing anything serious?
Hi everybody,
Here it's my problem I've a list of the following measure :
src1 dst2 24th december 2009
src1 dst3 22th december 2009
src1 dst2 18th december 2009
I would like to have just the latest measures with a sql request - 2 first lines in my case because the pairs(src and dst) aren't the same.
I try to use DISTINCT but I have just the 2 first columns and I will all columns.
I try too GROUP BY but I hadn't success.
Anyone can help me ?
Thx
Narglix
Please, give me the most serious arguments against this.
Application directly opens a connection to ms sqlserver, directly executes queries.
So what I'd like to ask:
1) Why it is wrong?
2) What serious problems can that cause?
3) What should I do?:)
I need to select static colums + a dynamic number of rows as columns in SQL
TABLE 1
-------
HotelID
BlockID
BlockName
TABLE 2
-------
BlockDate (unknown number of these)
NumberOfRooms
Desired Result Row
------------------
HotelID | BlockID | BlockName | 02/10/10 | 02/11/10 | 02/12/10 | ...N
Where the date columns are the unknown number of BlockDate rows.
Hi
I have the following SQL SELECT statement
SELECT bar_id, bar_name, town_name, advert_text
FROM bar, towns, baradverts
WHERE town_id = town_id_fk
AND bar_id = bar_id_fk
My problem is that since not every bar has an advert in table "baradverts", these bars are not coming up in the results. In other words I need a NULL for those bars that do not have an advert string.