t-sql Questions
7
Solved
Trying to create Database as follows:
USE Master
GO
IF NOT EXISTS(SELECT [Name] FROM sys.databases WHERE [name] = 'QAudit')
CREATE DATABASE [QAudit] ON PRIMARY
( NAME = N'QAuditData', FILENAM...
Tenorite asked 9/9, 2009 at 4:39
3
Solved
Given an update statement like so:
UPDATE
UserAssesment
SET
AssessmentDate = comp.AssessmentDate
FROM
UserAssesment ua
INNER JOIN
vw_CompletedAssessments comp
On
ua.NatId = comp.NatId and...
Endorsement asked 5/5, 2014 at 5:27
6
Solved
I'm trying to parse a sort of big SQL script containing commands like create functions and store procedures. I want to split the file in strings whenever I find a GO statement (I want to execute it...
6
Solved
Query should output a certain list of Items, along with info like store information and manager info. Uses a Cursor to flip through list of various different levels of management, selects relevant ...
Scrapbook asked 19/6, 2014 at 18:7
4
Solved
BEGIN TRY
EXEC N'EXEC sp_testlinkedserver N''[MyLinkedServer]'';';
END TRY
BEGIN CATCH
SELECT 'LinkedServerDown' AS Result
RETURN
END CATCH
SELECT TOP(1) FirstName FROM [MyLinkedServer].TestData...
Ginsburg asked 14/10, 2015 at 16:20
6
Solved
I have an attachments table that stores the size of the document in Bytes.
I'm needing to display a result set of all documents in either KB or MB. In KB if the document is less than 1MB or in MB ...
Rental asked 9/2, 2017 at 0:4
3
Solved
declare @minDateTime as datetime;
declare @maxDateTime as datetime;
set @minDateTime = '2014-01-13 02:00:00';
set @maxDateTime = '2014-12-31 14:00:00';
I am looking to create a select statement ...
Weft asked 27/11, 2014 at 0:59
7
Solved
OK. I'm doing an update on a single row in a table.
All fields will be overwritten with new data except for the primary key.
However, not all values will change b/c of the update.
For example, if m...
Viceroy asked 26/1, 2010 at 0:45
5
Solved
I am doing some performance testing on a SQL sproc and just want to bang out a quick data generator for testing.
I am after a simple way to generate a pseudo random (true random not needed in this...
5
Solved
I have a table (Table1) which has a composite primary key(Column1 + Column2). I am using it as a foreign key in another table (Table2).
Now I want to a SELECT statement to select all records from ...
Lotuseater asked 21/3, 2011 at 16:55
4
Solved
I want to create a clustered columnstore index in a table using the following query:
CREATE CLUSTERED COLUMNSTORE INDEX cci
ON agl_20180319_bck
And I am getting this error:
Msg 35343, Level 16, S...
Proxy asked 19/3, 2018 at 14:33
5
Solved
I'm trying to convert my Date which is (eg. 2012-04-20 05:54:59) format in into mm-yyyy. I came across some solutions that says you would need to convert into varchar . Is there any way using the C...
Immaterialism asked 3/3, 2015 at 22:6
3
In Azure Data Studio (ADS), is it possible to reuse SQL parameters from query to query? Not sure if I'm jumping out of the intended purpose of ADS but it would be really great if I could declare a ...
Fugleman asked 25/11, 2019 at 14:50
2
Solved
I've written a trigger.
USE [TEST]
GO
/****** Object: Trigger [dbo].[TR_POSTGRESQL_UPDATE_YC] Script Date: 05/26/2010 08:54:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGG...
Burnett asked 26/5, 2010 at 6:5
6
Solved
I am working on a query that will collect data from a table and display the data for a report.
The data looks like this:
Player Score
001 10
001 20
002 20
002 20
001 10
002 10
003 20
002 20
001 ...
Magog asked 28/9, 2012 at 18:18
4
Solved
Is it possible, just using TSQL, to check if the first two characters of a varchar field are alphabetical?
I need to select from my_table only the rows having my_field beginning with two alphabeti...
Fortissimo asked 13/9, 2012 at 13:34
5
I have several stored procedures in my database, structured like this:
CREATE PROCEDURE MyProcedure (.....)
AS
DECLARE @myvar NVARCHAR(100);
SET @myvar = (SELECT .... FROM my_table WHERE ....)
G...
Viscountess asked 10/3, 2015 at 10:1
0
I am working on a SaaS application that connects to a Microsoft SQL Server database, using T-SQL language.
I cannot develop stored procedures, user-defined functions, or any database objects.
I am ...
Rally asked 4/7 at 0:32
4
Solved
Consider a Sample Table with two Column RoleId and User Name
Role | Name
1 AB
3 A
1 ABC
2 D
2 B
3 Abb
1 E
4 TE
How can i use SQL queries to get following Output.
Role | Name
3 A
3 Abb...
Ph asked 5/1, 2016 at 15:15
5
I am not sure if its possible, but would really appreciate any assistance.
I am looking for a script which can generate the complete list of SQL Server databases with the following details for eac...
Ellanellard asked 29/5, 2012 at 9:30
3
Solved
I am trying to filter some SQL server data and require results with the following conditions:
where the field has alphanumeric characters, case insensitive
where the field has certain punctuation...
Semblable asked 5/1, 2012 at 14:32
5
Solved
I am having SQL server 2008 and i am having 10 different databases in it and now i want to search one stored procedure that in which database the stored procedure is present.
Mentioned as duplicat...
Furthermore asked 23/3, 2015 at 9:47
11
Solved
I have a stored procedure that has to accept a month as int (1-12) and a year as int. Given those two values, I have to determine the date range of that month. So I need a datetime variable to repr...
Eugeniaeugenics asked 12/10, 2010 at 15:36
5
Solved
Query:
update mytable
set mycol = null
where id in (
583048,
583049,
... (50000 more)
)
Message:
The query processor ran out of internal resources and could not
produce a query plan. This i...
Bonitabonito asked 18/10, 2011 at 8:8
4
Solved
What is the equivalent of:
TRUNC(SYSDATE)
...in SQL Server 2005?
Calfskin asked 11/11, 2009 at 5:0
1 Next >
© 2022 - 2024 — McMap. All rights reserved.