Here's a few of the new posts today on the forums. To see more, visit the forums.
|
SQL Server 2017 - Development |
T-SQL to find gaps in Date field of table - I'm inexperienced in asking these questions in a forum. I'm sure there's a more elegant way to display this code, etc. I hope I can explain what I'm after here. I have a simple table with a record ID and a date column in it. You can run this simple code to create the table […] |
Dividing a string column - I have a table that has one column that has multiple values. I need to create a new table with each value in a column and I am not sure how. create table #mytable ( ID NVARCHAR(50), MainImage nvarchar(MAX) ) INSERT INTO #mytable (ID, MainImage) VALUES('asdf123', '["0535bd68e0b14c0f6ff78dff12a7da56e81bd5d0", "27d8b9e313e5c50a650168bea38052cd49fc48b2","cbdfd4438d8259baacad4db3f66d7178c0648f38", "b53afe5d5471003d90e09906f08c0b0fc43004b4","53c6a621ec464a8d174e8094e883bddb5db7c795"]'), ('asdf144', '03e9c0f463de2d92db2fe89790cf8c80d616b825'), ('asthd23', '["b82ae6fa21714e0a3885bdd78195b94fbabd5d65","b66347b4c5436bd69aa427bbbe59d566e024389f"]'); select * […] |
NOT Operator and NULLs - --test data declare @T table(a int null, b int null) insert @T(a, b) select 0, 0 union all select 1, 0 union all select 0, 1 union all select 1, 1 union all select null, null union all select 0, null union all select null, 0 union all select 1, null union all select null, […] |
SQL Server 2016 - Administration |
AOAG did not failover to other node - We had a crash on primary node, created memory dump. But AOAG group did not fail over to secondary node. So, when we encounter memory dump on primary, does AOAG will not fail over? are there any scenarios where AOAG fail over will not work? |
Trying to deny delete inside a procedure - So the scenario is that I have a user with a role of db_datareader and db_executor. They get an error when they try and run a plain delete statement, however I have a stored procedure that has delete statements in it and they are not blocked. I have tried denying delete on the role and […] |
power shell script for add datetime to file - Hi, i would like to generate csv file with datetime through sql job with below power shell script.But it didn't work. Any suggessions. $dt=get-date -format "_yyyymmmd_HHmss" Invoke-Sqlcmd -Query "SELECT * FROM [xxxxxx].[xxxx].[xxxxx]" -ServerInstance "LocalHost" | Export-Csv -Path D:\folder\data$dt.csv" -NoTypeInformation Thanks. |
SQL Server 2016 - Development and T-SQL |
Union with temp table - insert into dbo.details ( DetailId ,DetailName ) select distinct st.stdid ,st.name from dbo.student st UNION select distinct dt.depid ,dt.name from dbo.department dt UNION select distinct Ot.Ordid ,Ot.OrderName from dbo.Orders Ot i have 3 different select statements where i am doing union and inserting into table; How can i keep all the three select statements in […] |
need help with a query to avoid while loop - i am struggling with a query to avoid while loop, please guide me if it can be done without a while loop. --create temp table create table #minmaxvalues ( MaxVal sql_variant, MinVal sql_variant, percentval decimal(28,4) ) -- insert values insert into #minmaxvalues select 15765, 0 ,'1.0000' union select 374922, 15765, '1.0000' union select 1178099, 374922, […] |
SQL 2012 - General |
Migrate SQL Failover to Always on - Hi,Currently we have a sql failover cluster with an attached iscsi target. This consists of 3 windows server 2012 R2 machines w/SQL server 2012. We are looking to move to an always on group instead. Can this be accomplished with using the same sql servers in the cluster? What is the best path to accomplish […] |
How can I do a simple SUM query - This is not working. It does not like the Date used, and Something about aggregate and group by clauses... SELECT EmpNo, Date1, SUM(Time) as Expr1 FROM TimeData WHERE (EmpNo = '8939') AND (Date1 = #11/18/2019#) GROUP BY EmpNo |
SQL Server 2012 - T-SQL |
how to lock the record - Hello, i have a table called Codes and having below columns Declare table Codes(IdCode int identity(1,1) primary key, EmpCode varchar(10) unique key, AllotedStatus bit default 0) i will get list of EmpCode from the client and i will fill it in this table. my requirement is, users will login to our website and request for […] |
SQL Server 2008 - General |
HTML page execute a procedure - I have zero front end coding skills; last time I worked with any code like that was Visual Basic 6. I'd like to have a html page on my local machine where I could organize the execution of procedures. I have to pass a parameter. Does anyone have a sample? Is there some easy web […] |
Distance Zip Code Database - Hello, I am looking to find away to determine the distance between one Zip Code and another Zip Code in a database. For example, I would like to determine how far Customer A is from Customer B based on each Customer's Zip Code. Can someone help me understand how this can be done? I am […] |
Integration Services |
SSIS 2016 with Catalogs - So I am seeing something strange moving from SSIS 2008 to 2016 with Catalog. I must install SSIS on every SQL server and only connect to that server with my SSIS packages, else it using NT Authority /Anonymous Logon to connect to any server that is not local. For example I have a Job that […] |
SSIS 2016, cannot bulk load - My SSIS package fails on "Execute SQL Talk" which executes a stored procedure trying to load XML file. I get the following error: [Execute SQL Task] Error: Executing the query "exec [dbo].[AccuplacerXMLProcessing] ?" failed with the following error: "Cannot bulk load. The file "J:\Accuplacer\000753-001\16209412.xml" does not exist.". Possible failure reasons: Problems with the query, "ResultSet" […] |