from one Query is it possible to do? To insert Multiple selected row information from one table to other table like: Customers (register_no,CustomerName, City, Country) Suppliers(register_no,SupplierName, City, Country) INSERT INTO Customers (register_no,CustomerName, City, Country) SELECT register_no SupplierName, City, Country FROM Suppliers where register_no=10; But in one time is it possible to select register_no=1,register_no=3,register_no=10; in one […]
I have a table T with (first, second) columns. I have two rows with first=1 and second=2. I would like to delete just one of the rows. How do I do that?
i am doing this: CREATE TABLE person ( num INT NOT NULL , firstname VARCHAR(20) NULL , lastname VARCHAR(30) NULL ); sql server is just saying “debbuging” and it’s not doing anything is there a problem with the syntax or what?
I’ve got a stored procedure with a query: SELECT ID ,AmountInCurrency ,ExtractionDate FROM Table This query returns 2 rows: ID AmountInCurrency ExtractionDate 1 8.00 2013-10-17 10:00:00.000 1 10.50 2013-09-16 09:00:00.000 I want to select the Min and Max Extrationdate into variables @mindate and @maxdate. Right now I put the resultset into a temp table and […]
I need to return all the entries in my database that are fairly close to a given point. At the moment I am doing this (in the WHERE section): OR ( (Addresses.Latitude IS NOT NULL) AND (Addresses.Longitude IS NOT NULL) AND ( Abs(Addresses.Latitude – @SearchInLat) < 0.5) AND ( Abs(Addresses.Longitude – @SearchInLng) < 0.5) ) […]
This is one of the most interesting issue that I have come across in quiet some time. I have a scalar function defined in SQL server 2008 which whose return type is varchar(max) This is the query: Select dbo.GetJurisdictionsSubscribed(u.UserID) as ‘Jurisdiction’ From Users u ORDER BY Jurisdiction desc Could anybody explain why would AAAA… 2nd […]
I am using SQL Server 2014 and I have a query with this line of code: ISNULL(b.[LEISURE],0) AS ‘LEISURE’ The value of Leisure can also be negative, in which case I want the value to also show as 0. How do I wrap both conditions in my code?
I would like to insert a range of values into a pair of SQL tables, with data requiring some pre-processing (like attaching a common time stamp and some revamp of the data in both tables). Ideally I prefer to shield my code from direct SQL statements, opting to use stored procedures instead. How could I […]
Im trying to create a GRANT script for a DB. The DB cannot use any built in roles, so I need to re-create db_reader, db_writer and EXEC for stored procedures into a GRANT script assigned to this service account. I am trying to automate this, instead of looking at each item in the DB and […]
The problem is I need to ignore the stray Letters in the numbers: e.g. 19A or B417