I’m creating an ssrs report and creating a mockdata sql script. In the script I want to insert a decimal value like so: The values after “someString” are actually one decimal value with a comma as decimal separator. SQL interprets this as separate values though and hence throws an error abou…
Tag: sql
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.…
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
SQL server 2012 SP_HELPTEXT extra lines issue
I am using SQL server 2012, & always use SP_HELPTEXT to get my previously created Stored Procedures, In previous versions of SQL server there were no issues in this process but in 2012, My Stored Procedures come with extra lines, for example this is the procedure that I wrote Now after using SP_HELPTEXT w…
Change default date format of the asp sql database ( the one storing the values)
I have a gridview and SqlDatasource. I have a column called Date VMS which is type Date. I’ve noticed that the format for adding a date won’t allow adding a date like: 30/02/2012. ( DD/MM/YYYY) I have an Excel sheet from which I’m copying the rows and I’m adding them in the table. The …
Error in LINQ to SQL: specified cast is not valid
Hi I am trying to learn LINQ, and in LINQ to SQL I have got following exception: This is a sample code from Linq In Action by Manning publications. Whats wrong? Exception details: Answer If my memory serves, the Customers table in Northwind does not have CustomerID as int (I think its NVARCHAR). If you wrote …
finding sum of values found from a query
I have a query which returns two rows of data as count. I want to find sum of the column values. My sql: I have tried using Select Sum(my above query) but I am getting error. I just need some of above values. Answer Can grab both result sets in a single query:
Does PostgreSQL support “accent insensitive” collations?
In Microsoft SQL Server, it’s possible to specify an “accent insensitive” collation (for a database, table or column), which means that it’s possible for a query like to find a row with a Joao name. I know that it’s possible to strip accents from strings in PostgreSQL using the u…
Using group by for attributes which will not be selected
Let’s suppose that I have the following table: The question is: Can I group the selection with attributes which don’t appear in the select clause? For example: I know that in this case the group by clause is useless, but it just an example. Is this correct? Answer It’s implementation depende…
How to check any missing number from a series of numbers?
I am doing a project creating an admission system for a college; the technologies are Java and Oracle. In one of the tables, pre-generated serial numbers are stored. Later, against those serial numbers, the applicant’s form data will be entered. My requirement is that when the entry process is completed…