I'm looking for a tool that that I can use to clean up (formatting, tabs etc...) my stored procedures and views. Is there anything like html's tidy, but for SQL which is free/open source?
Hello everyone,
I am using SQL Server 2008 Enterprise and using the new Merge statement. From my experiment, I find source is always read only (table content not modified, i.e. no record is deleted/inserted/updated)? Is that correct understanding?
thanks in advance,
George
I have a stored procedure which is returning me about 50 columns. I want to write a query, where I will be able to select a particular column from the list of column returned by the SP.
I tried writing select RSA_ID from exec(uspRisksEditSelect '1') But Its throwing me an error.
I think we need to write some dynamic sql for it. But I am new to it.
Hi,
I have two servers where I installed SQL Server 2008
Production: RAID 1 on SCSI disks
Test: IDE disk
When I try to execute a script with about 35.000 inserts, on the test server I need 30 sec and instead on the production server more than 2 min!
Does anybody know why such difference? I mean, the DB is configured in the same way and the production server has also a RAID config, a better processor and memory...
THANKS!
Hi.
I am new to this cubes concept in SQL Server. I need to connect to cubes and query and get a result and display that result in grid view
Any help would be great telling how to connect to a cube, articles on it, code any thing that can help me to achieve the result
Thank you.
How do I prevent SQL injection when it comes to ColdFusion? I'm quite new to the language/framework.
Here is my example query.
<cfquery name="rsRecord" datasource="DataSource">
SELECT * FROM Table
WHERE id = #url.id#
</cfquery>
I see passing in url.id as a risk.
I have developed my own word breaker for SQL 2005 and the Full Text Search feature. I know how to use it by simply hijacking an existing language and add the wordbreaker to the registry for the hijacked language. However I'm not completely satisfied with that solution. I want to create a completely new language is this possible?
hi!
Is there a way to insert only date in a datetime column in sql server without the time?
for example
date (datetime)
===============
12-01-2000
16-02-2000
or i should store this as a varchar and cast it when retriving so that i can convert to whatever form i need.
I have a computer working as a server with many SQL Server 2005 databases in it since two years ago.
Today, I don't know why, when I try to connect locally to any of the databases it gives me that error. It fails even if I'm logged in using Windows Authentication or as 'sa' user. It just wouldn't let me access the databases' info.
Could anybody explain me what's going on?
I want to be able to perform a IF...THEN in an SQL SELECT Statement.
For Example;
SELECT IF(Obsolete = 'N' or InStock = 'Y';1;0) as Salable, * FROM Product
For certain types of sql queries, an auxiliary table of numbers can be very useful. It may be created as a table with as many rows as you need for a particular task or as a user defined function that returns the number of rows required in each query.
What is the optimal way to create such a function?
Hi,
I just noticed that if I have an identity column in a table, when I insert new rows SQL Server 2008 is automatically filling up the sequence if there are discontinuity. I mean, if in my identity column I have 1,2,5,6 if I insert other two rows in the table the system puts automatically 3,7 in the identity column.
Do you know how to control this behavior?
THANKS
Is there an method for programatically (in T-SQL) retrieving the maximum (and minimum) value of a datatype? That it would act like float.MaxValue in C#.
I would like to use it in some selection when the parameter does not equal any actual values in the database, so I would use something like
declare @min float
declare @max float
/*fill @min and @max, can be null if undefined*/
select * from foo
where bar between isnull(@min,0 ), isnull(@max,max(float)/*magic*/)
Thanks
Hi Experts,
I am using sql server 2005
I have a table [say tblHistory] and this table contains 100 rows.
I have created the same table at the server, but the table doesn't have the data, I want data from tblHistory to convert into
INSERT INTO tblHistory ------
so that I could run the script on the server to fill the database.
Please help, it's urgent
Hi Experts,
I have a tables with data like this
Id BookId TagId
34 113421 9
35 113421 10
36 113421 11
37 113421 1
38 113422 9
39 113422 1
40 113422 12
I need to write a query (SQL Server) which gives me data according to the tags say if I want bookIds where
tagid =9 it should return bookid 113421 and 113422 as it exists in both the books, but If I ask data for tags 9 and 10 it should return only book 113421 as that is the only book where both the tags are present.
Thanks
Parminder
Question: The new SQL Server 2008 database returns me values formatted English (date/float).
Is there a way I can set the return format ?
For example temporarely switching the database language?
Or just set the language for the current query ?
Sql server 2005 (even 2008) strips the insignificant whitespaces by default. To keep one can use the CONVERT funtction with the last argument as '1' (Ref. Article). How can we do the same thing in Entity Framework?
thanks
I need to find the path of the database (MDF) or at least the database logs loaded but for some reasons I cannot login through the SQL Server so I need to know if you know any file/config file that keeps the path of the databases or log file .
In sql server 2008, i have taken Full backup type of my database and database was successfully done.My question is while restoring it how can i check or know that my whole backup was perfect ?
Hi there,
I am trying to write a sql statement that
I have 2 tables Store & StoreTransactions.
My first select command looks like
SELECT [StoreID],[ParentStoreID]
FROM Store
Very simple stuff. How do I take the returned StoreID's and use them for my 2nd select statement?
SELECT [StoreTransactionID],[TransactionDate],[StoreID]
FROM StoreTransactions
WHERE StoreID = returned values from the above query
Any help would be great!
I'm writing a tool to gather customer configuration information. One of the questions I want to answer, what OS is the customer database running on.
I haven't found a generic way to find the OS with SQL and I can't create stored procedures on the customer's database.
If there is a way, it's probably vendor specific.
Suggestions? Thanks in advance.
Are there any updates in SQL 2008 to allow a variable for the IN of a where clause?
Declare @InParams varchar(100)
Set @InParams = '1,2'
Select * from Category
Where CategoryID in @InParams