I have several tables in my database and I am using the SQL Server Management Studio for the first time. I want to see the data. In an SQLite 3 or MySQL I’d simply type SELECT * FROM tblName WHERE… the output would be in my console. Answer In SSMS open a new query window (Ctrl + n), make sure
Tag: sql-server-2008
SQL Server 2008 – Email notifications
I have a SQL server / database locally and accessed through ip etc… What I want to know is how to send emails directly from the server (when n happens)? Answer You can use Database Mail. To send e-mails via SQL Server you can use the following stored procedure: sp_send_dbmail Or how to configure a SQL agent to send mail
Parse SQL Server Data
I used SSIS and [SharePointListAdapters][1] [1]: http://sqlsrvintegrationsrv.codeplex.com/releases to import data from my SharePoint 2010 list and put it into SQL Server 2008 table. TThere are roughly 500 rows of data. Now the challenge is to parse data appropriately. I have a couple of columns that have html tags around them. For e.g., Column Project Desc has data like Project Desc
how to use like and between in where clause in same statement?
Im trying to find a set of results in a database based on dates. The dates are stored as varchars in the format dd/mm/yyyy hh:mm:ss. What i would like to do is search for all dates within a range of specified dates. For example i tried: Is something like this possible or is there a better way of doing this
Unexpected database output when using INNER JOIN
I have the following SQL query SELECT r.BEZEICHNUNG AS BEZEICHNUNG, r.ID AS ID, ra.BEZEICHNUNG AS raumBEZEICHNUNG, ra.ID AS raumID FROM RAUM r INNER JOIN RAZUORDNUNG rz …
how can i set the parameters for the sql query optional?
I build a Web Service in ASP.Net which sends me a list of rooms. The parameters are id’s which are separated by a comma. I saved them to a string and build a sql select query. When I send all 4 parameters I everything works fine and I get a result. But when I send less then 4 I get
How to describe table in SQL Server 2008?
I want to describe a table in SQL Server 2008 like what we can do with the DESC command in Oracle. I have table [EX].[dbo].[EMP_MAST] which I want to describe, but it does not work. Error shown: The object ‘EMP_MAST’ does not exist in database ‘master’ or is invalid for this operation. Answer According to this documentation: DESC MY_TABLE is
Select the first instance of a record
I have a table, myTable that has two fields in it ID and patientID. The same patientID can be in the table more than once with a different ID. How can I make sure that I get only ONE instance of every patientID.? EDIT: I know this isn’t perfect design, but I need to get some info out of the
Delete statement in SQL is very slow
I have statements like this that are timing out: I tried doing one at a time like this: and so far it’s at 22 minutes and still going. The table has 260,000 rows in it and is four columns. Does anyone have any ideas why this would be so slow and how to speed it up? I do have a
SQL Server – copy stored procedures from one db to another
I am new to SQL, and what I needed to do was to combine 2 .mdf databases into one. I did that using SQL Server 2008 Manager – Tasks > Import/Export tables.The tables and views were copied successfully, but there are no Stored procedures in the new database. Is there any way to do that? Answer Right click on database